Systemd cannot run my startup script
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I've taken a look at every question regarding systemd here and cannot seem to find the answer, so I apologize if I'm somehow missing it.
I just want to run the following script at startup, but it seems it must be after systemd finishes because it is dependent upon the network and gui to be up. I'm trying to set up the mousepad to allow tap-clicking, and trying to run a connect.sh script which connects me to a VPN. The following script does everything it's supposed to do when I run it manually, but I cannot for the life of me figure out why it won't run at startup.
startup.sh:
#! /bin/sh
# /root/Scripts/startup.sh
synclient tapbutton1=1 clickfinger2=3 tapbutton2=3
sleep 2
sh /root/Scripts/connect.sh
sleep 10
contents of connect.sh:
#! /bin/sh
# /root/Scripts/connect.sh
echo "disabling wifi adapter..n"
ifconfig wlan0 down
sleep 3
macchanger -r wlan0
echo "enabling wifi adapter..n"
ifconfig wlan0 up
sleep 3
echo "connecting to VPN..n"
nmcli con up id vpnconnection1
sleep 3
ifconfig
echo "finishedn"
/etc/systemd/system/mystartup.service:
[Unit]
After=network.target
[Service]
ExecStart=/root/Scripts/startup.sh
[Install]
WantedBy=default.target
I run systemctl enable mystartup.service
and reboot, but the script clearly hasn't run since the changes have not taken effect.
What am I doing wrong?
EDIT: I updated the scripts to reflect the absolute paths to the script locations. ran systemctl
and rebooted, but still not working.
For more clarification, I just want to run these two scripts at startup. Registering them as a service doesn't make sense to me, but everything I've researched has brought me here. That said, systemctl --state=failed
doesn't show mystartup.service listed, and service mystartup.service status
says Unit mystartup.service.service could not be found.
systemd kali-linux
 |Â
show 6 more comments
up vote
2
down vote
favorite
I've taken a look at every question regarding systemd here and cannot seem to find the answer, so I apologize if I'm somehow missing it.
I just want to run the following script at startup, but it seems it must be after systemd finishes because it is dependent upon the network and gui to be up. I'm trying to set up the mousepad to allow tap-clicking, and trying to run a connect.sh script which connects me to a VPN. The following script does everything it's supposed to do when I run it manually, but I cannot for the life of me figure out why it won't run at startup.
startup.sh:
#! /bin/sh
# /root/Scripts/startup.sh
synclient tapbutton1=1 clickfinger2=3 tapbutton2=3
sleep 2
sh /root/Scripts/connect.sh
sleep 10
contents of connect.sh:
#! /bin/sh
# /root/Scripts/connect.sh
echo "disabling wifi adapter..n"
ifconfig wlan0 down
sleep 3
macchanger -r wlan0
echo "enabling wifi adapter..n"
ifconfig wlan0 up
sleep 3
echo "connecting to VPN..n"
nmcli con up id vpnconnection1
sleep 3
ifconfig
echo "finishedn"
/etc/systemd/system/mystartup.service:
[Unit]
After=network.target
[Service]
ExecStart=/root/Scripts/startup.sh
[Install]
WantedBy=default.target
I run systemctl enable mystartup.service
and reboot, but the script clearly hasn't run since the changes have not taken effect.
What am I doing wrong?
EDIT: I updated the scripts to reflect the absolute paths to the script locations. ran systemctl
and rebooted, but still not working.
For more clarification, I just want to run these two scripts at startup. Registering them as a service doesn't make sense to me, but everything I've researched has brought me here. That said, systemctl --state=failed
doesn't show mystartup.service listed, and service mystartup.service status
says Unit mystartup.service.service could not be found.
systemd kali-linux
maybe change WantedBy=default.target to WantedBy=multi-user.target ?
â tonioc
Mar 15 at 8:56
2
Tell us the error messages. Show us what the logs say about the service. Prove to us, with service status and log output edited into the question, that the service has not run.
â JdeBP
Mar 15 at 8:59
Ok, the systemd log says it is definitely running, but gettingFailed to connect to X Server
and the connect.sh script runs but doesn't do what it's supposed to do, so this doesn't solve my problem. As I said above, the script needs to run at the very end of the systemd startup. I will open a new question, thank you.
â nohupt
Mar 15 at 9:28
3
Debian or Kali-Linux ?
â Kiwy
Mar 15 at 9:33
@Kiwy Kali is Debian.
â nohupt
Jun 19 at 3:46
 |Â
show 6 more comments
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I've taken a look at every question regarding systemd here and cannot seem to find the answer, so I apologize if I'm somehow missing it.
I just want to run the following script at startup, but it seems it must be after systemd finishes because it is dependent upon the network and gui to be up. I'm trying to set up the mousepad to allow tap-clicking, and trying to run a connect.sh script which connects me to a VPN. The following script does everything it's supposed to do when I run it manually, but I cannot for the life of me figure out why it won't run at startup.
startup.sh:
#! /bin/sh
# /root/Scripts/startup.sh
synclient tapbutton1=1 clickfinger2=3 tapbutton2=3
sleep 2
sh /root/Scripts/connect.sh
sleep 10
contents of connect.sh:
#! /bin/sh
# /root/Scripts/connect.sh
echo "disabling wifi adapter..n"
ifconfig wlan0 down
sleep 3
macchanger -r wlan0
echo "enabling wifi adapter..n"
ifconfig wlan0 up
sleep 3
echo "connecting to VPN..n"
nmcli con up id vpnconnection1
sleep 3
ifconfig
echo "finishedn"
/etc/systemd/system/mystartup.service:
[Unit]
After=network.target
[Service]
ExecStart=/root/Scripts/startup.sh
[Install]
WantedBy=default.target
I run systemctl enable mystartup.service
and reboot, but the script clearly hasn't run since the changes have not taken effect.
What am I doing wrong?
EDIT: I updated the scripts to reflect the absolute paths to the script locations. ran systemctl
and rebooted, but still not working.
For more clarification, I just want to run these two scripts at startup. Registering them as a service doesn't make sense to me, but everything I've researched has brought me here. That said, systemctl --state=failed
doesn't show mystartup.service listed, and service mystartup.service status
says Unit mystartup.service.service could not be found.
systemd kali-linux
I've taken a look at every question regarding systemd here and cannot seem to find the answer, so I apologize if I'm somehow missing it.
I just want to run the following script at startup, but it seems it must be after systemd finishes because it is dependent upon the network and gui to be up. I'm trying to set up the mousepad to allow tap-clicking, and trying to run a connect.sh script which connects me to a VPN. The following script does everything it's supposed to do when I run it manually, but I cannot for the life of me figure out why it won't run at startup.
startup.sh:
#! /bin/sh
# /root/Scripts/startup.sh
synclient tapbutton1=1 clickfinger2=3 tapbutton2=3
sleep 2
sh /root/Scripts/connect.sh
sleep 10
contents of connect.sh:
#! /bin/sh
# /root/Scripts/connect.sh
echo "disabling wifi adapter..n"
ifconfig wlan0 down
sleep 3
macchanger -r wlan0
echo "enabling wifi adapter..n"
ifconfig wlan0 up
sleep 3
echo "connecting to VPN..n"
nmcli con up id vpnconnection1
sleep 3
ifconfig
echo "finishedn"
/etc/systemd/system/mystartup.service:
[Unit]
After=network.target
[Service]
ExecStart=/root/Scripts/startup.sh
[Install]
WantedBy=default.target
I run systemctl enable mystartup.service
and reboot, but the script clearly hasn't run since the changes have not taken effect.
What am I doing wrong?
EDIT: I updated the scripts to reflect the absolute paths to the script locations. ran systemctl
and rebooted, but still not working.
For more clarification, I just want to run these two scripts at startup. Registering them as a service doesn't make sense to me, but everything I've researched has brought me here. That said, systemctl --state=failed
doesn't show mystartup.service listed, and service mystartup.service status
says Unit mystartup.service.service could not be found.
systemd kali-linux
edited Jun 20 at 8:45
Kiwy
5,36743350
5,36743350
asked Mar 15 at 8:17
nohupt
112
112
maybe change WantedBy=default.target to WantedBy=multi-user.target ?
â tonioc
Mar 15 at 8:56
2
Tell us the error messages. Show us what the logs say about the service. Prove to us, with service status and log output edited into the question, that the service has not run.
â JdeBP
Mar 15 at 8:59
Ok, the systemd log says it is definitely running, but gettingFailed to connect to X Server
and the connect.sh script runs but doesn't do what it's supposed to do, so this doesn't solve my problem. As I said above, the script needs to run at the very end of the systemd startup. I will open a new question, thank you.
â nohupt
Mar 15 at 9:28
3
Debian or Kali-Linux ?
â Kiwy
Mar 15 at 9:33
@Kiwy Kali is Debian.
â nohupt
Jun 19 at 3:46
 |Â
show 6 more comments
maybe change WantedBy=default.target to WantedBy=multi-user.target ?
â tonioc
Mar 15 at 8:56
2
Tell us the error messages. Show us what the logs say about the service. Prove to us, with service status and log output edited into the question, that the service has not run.
â JdeBP
Mar 15 at 8:59
Ok, the systemd log says it is definitely running, but gettingFailed to connect to X Server
and the connect.sh script runs but doesn't do what it's supposed to do, so this doesn't solve my problem. As I said above, the script needs to run at the very end of the systemd startup. I will open a new question, thank you.
â nohupt
Mar 15 at 9:28
3
Debian or Kali-Linux ?
â Kiwy
Mar 15 at 9:33
@Kiwy Kali is Debian.
â nohupt
Jun 19 at 3:46
maybe change WantedBy=default.target to WantedBy=multi-user.target ?
â tonioc
Mar 15 at 8:56
maybe change WantedBy=default.target to WantedBy=multi-user.target ?
â tonioc
Mar 15 at 8:56
2
2
Tell us the error messages. Show us what the logs say about the service. Prove to us, with service status and log output edited into the question, that the service has not run.
â JdeBP
Mar 15 at 8:59
Tell us the error messages. Show us what the logs say about the service. Prove to us, with service status and log output edited into the question, that the service has not run.
â JdeBP
Mar 15 at 8:59
Ok, the systemd log says it is definitely running, but getting
Failed to connect to X Server
and the connect.sh script runs but doesn't do what it's supposed to do, so this doesn't solve my problem. As I said above, the script needs to run at the very end of the systemd startup. I will open a new question, thank you.â nohupt
Mar 15 at 9:28
Ok, the systemd log says it is definitely running, but getting
Failed to connect to X Server
and the connect.sh script runs but doesn't do what it's supposed to do, so this doesn't solve my problem. As I said above, the script needs to run at the very end of the systemd startup. I will open a new question, thank you.â nohupt
Mar 15 at 9:28
3
3
Debian or Kali-Linux ?
â Kiwy
Mar 15 at 9:33
Debian or Kali-Linux ?
â Kiwy
Mar 15 at 9:33
@Kiwy Kali is Debian.
â nohupt
Jun 19 at 3:46
@Kiwy Kali is Debian.
â nohupt
Jun 19 at 3:46
 |Â
show 6 more comments
1 Answer
1
active
oldest
votes
up vote
1
down vote
These don't really belong as systemd services...
Setting up the mousepad depends on X running and needs to be done for that session.
The proper way to set that up is to configure that as part of the X config.
See here for a way to configure that.
Regarding connecting to the VPN, you should probably configure that in NetworkManager, which controls your connections and knows when your network is up.
See here for a way to hook up a dispatcher script to NetworkManager that can bring the VPN up when the network is up.
I hope this helps!
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
These don't really belong as systemd services...
Setting up the mousepad depends on X running and needs to be done for that session.
The proper way to set that up is to configure that as part of the X config.
See here for a way to configure that.
Regarding connecting to the VPN, you should probably configure that in NetworkManager, which controls your connections and knows when your network is up.
See here for a way to hook up a dispatcher script to NetworkManager that can bring the VPN up when the network is up.
I hope this helps!
add a comment |Â
up vote
1
down vote
These don't really belong as systemd services...
Setting up the mousepad depends on X running and needs to be done for that session.
The proper way to set that up is to configure that as part of the X config.
See here for a way to configure that.
Regarding connecting to the VPN, you should probably configure that in NetworkManager, which controls your connections and knows when your network is up.
See here for a way to hook up a dispatcher script to NetworkManager that can bring the VPN up when the network is up.
I hope this helps!
add a comment |Â
up vote
1
down vote
up vote
1
down vote
These don't really belong as systemd services...
Setting up the mousepad depends on X running and needs to be done for that session.
The proper way to set that up is to configure that as part of the X config.
See here for a way to configure that.
Regarding connecting to the VPN, you should probably configure that in NetworkManager, which controls your connections and knows when your network is up.
See here for a way to hook up a dispatcher script to NetworkManager that can bring the VPN up when the network is up.
I hope this helps!
These don't really belong as systemd services...
Setting up the mousepad depends on X running and needs to be done for that session.
The proper way to set that up is to configure that as part of the X config.
See here for a way to configure that.
Regarding connecting to the VPN, you should probably configure that in NetworkManager, which controls your connections and knows when your network is up.
See here for a way to hook up a dispatcher script to NetworkManager that can bring the VPN up when the network is up.
I hope this helps!
answered Mar 22 at 7:42
Filipe Brandenburger
3,467621
3,467621
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f430343%2fsystemd-cannot-run-my-startup-script%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
maybe change WantedBy=default.target to WantedBy=multi-user.target ?
â tonioc
Mar 15 at 8:56
2
Tell us the error messages. Show us what the logs say about the service. Prove to us, with service status and log output edited into the question, that the service has not run.
â JdeBP
Mar 15 at 8:59
Ok, the systemd log says it is definitely running, but getting
Failed to connect to X Server
and the connect.sh script runs but doesn't do what it's supposed to do, so this doesn't solve my problem. As I said above, the script needs to run at the very end of the systemd startup. I will open a new question, thank you.â nohupt
Mar 15 at 9:28
3
Debian or Kali-Linux ?
â Kiwy
Mar 15 at 9:33
@Kiwy Kali is Debian.
â nohupt
Jun 19 at 3:46