I know adding script in startup time. Is it possible, adding script in system shutdown time? For an example Whenever a user, shutdown their PC, I want a history -c command will run in the background so that the user's previous worked commands can be erasing in the terminal. Is it possible?
Asked
Active
Viewed 354 times
1 Answers
2
To execute a script at shutdown:
- Put your script in
/etc/rc6.d - Make it executable:
sudo chmod +x K99_script - Notes:
- The scripts in this directory are executed in alphabetical order.
- The name of your script must begin with
K99to run at the right time.
For more info please see this link. Hope this helps.
Sources: