#[Solved] Script on startup

62 messages · Page 1 of 1 (latest)

finite hatch
#

How would i run a script on startup & it running in the background.

#

Using arch linux with KDE

unborn herald
#

On startup being as soon as you log in?

dreamy basalt
#

search for Autostart in start menu.

finite hatch
#

found it but how would i make that script run in the background

dreamy basalt
#

just press add -> add application and then open file dialog and select your script.

finite hatch
#

okay

#

and what if the script needs sudo password

#

how would i pass it in

dreamy basalt
#

I think you can do
chmod +x script_file
to give permissions

finite hatch
#

i did

bronze mirage
finite hatch
#

still asks for password

bronze mirage
#

.aw systemd

crystal mauveBOT
bronze mirage
#

Make a systemd service

#

That runs as root iirc

finite hatch
#

why is it spam starting and stopping

bronze mirage
#

i have no clue

#

send the script here

finite hatch
#

also did not even work

bronze mirage
#

send the script here

finite hatch
#

lol

bronze mirage
#

no i mean

#

*meant

#

the systemd service

#

sorry

finite hatch
#

oh

#

gotcha

#
[Unit]
Description=USB Kill
After=network.target

[Service]
ExecStart=/home/emanuel/usb_kill.sh
Restart=always

[Install]
WantedBy=default.target
bronze mirage
#

also i think you did some of that wrong

finite hatch
#

true

bronze mirage
#

let me see

#

@finite hatch restart=always is not a good idea i think

#

try smth like this ```ini
[Unit]
Description=USB Kill
After=network.target

[Service]
ExecStart=/home/emanuel/usb_kill.sh

[Install]
WantedBy=multi-user.target

finite hatch
#

do i really need After

bronze mirage
#

uh

#

well idk

#

what that does

#

is make it run after network.target is run

#

so

#

i think thats after network works

#

if you need network for this yes

#

otherwise no

finite hatch
#

nah i dont

#

also

#

do i need to restart the service

#

if i edited it

#

or

bronze mirage
#

use this ^^

finite hatch
bronze mirage
finite hatch
#

it works now

bronze mirage
#

nice!

#

edit this posts title so it says [Solved] at the start please @finite hatch