After writing a startup script, shutdown is delayed

If none of the more specific forums is the right place to ask

After writing a startup script, shutdown is delayed

Postby calkekecal » 2018-09-09 09:12

After writing the below script, putting it into /etc/init.d, I entered following commands to terminal:

sudo chmod +x /etc/init.d/macchanger.sh
sudo chown root:root /etc/init.d/macchanger.sh
sudo update-rc.d macchanger.sh defaults
sudo update-rc.d macchanger.sh enable

However now when I shutdown it gives two errors: "A stop job is running for LSB: macchanger.sh
A start job is running for Network Manager.

What can be the problem?

SCRIPT:

#!/bin/sh
### BEGIN INIT INFO
# Provides: macchanger.sh
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Change MAC on every boot
# Description: macchanger.sh
### END INIT INFO
sudo ip link set wlp3s0 down
sudo service network-manager stop
sudo macchanger -r wlp3s0
sudo ip link set wlp3s0 up
sudo service network-manager start
calkekecal
 
Posts: 8
Joined: 2017-07-22 09:22

Re: After writing a startup script, shutdown is delayed

Postby debiman » 2018-09-09 09:19

first of all you should remove all sudo from that script - it is executed as root anyhow.

i think you should make this script into a systemd service instead.

i don't think an init script should contain commands to start/stop other init scripts, doesn't matter whether it's systemd or sysvinit.
User avatar
debiman
 
Posts: 3017
Joined: 2013-03-12 07:18


Return to General Questions

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable