0

I have created python script and want to run it at time of shutdown.

I have saved the script in /etc/init.d and created a soft link for it in the rc0.d directory, but the script is not working.

I am able to run the same script manually but it is not executed at time of shutdown.

2
  • Is it "not working" in any particular way (error messages?), or is it just not executing? – Kusalananda Jan 1 '17 at 19:19
  • i mean to say the script is not executed when system shutdown – NIKHIL SHARMA Jan 2 '17 at 4:13
1

You need to place the softlink into rcX.d where X is the runstate you are in, and is generally 3.

You need to name the softlink KXXyyyyy, where K stands for "kill", XX is a two digit number that specifies the order the scripts are run during shutdown, and yyyyy is arbitrary but is by convention the name of the script the softlink points to.

3
  • I have palced the script in the init.d location and when we need to run the script i have created the same situation but not able to run that script when we check that script manually if we run the script it is working fine but if we place. – NIKHIL SHARMA Jan 2 '17 at 8:30
  • @Kusalananda placed the script in the init.d location and when we need to run the script i have created the soft link (K00zabbix_remove.py) situation but not able to run the script and when we run that script manually it is working fine. – NIKHIL SHARMA Jan 2 '17 at 8:34
  • @StephenRauch, that last comment is not for me but for you. – Kusalananda Jan 2 '17 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.