Skip to content

Instantly share code, notes, and snippets.

@oropesa
Created December 12, 2019 16:43
Show Gist options
  • Save oropesa/a7a3ac3a03fb8dd36a53c61d28635796 to your computer and use it in GitHub Desktop.
Save oropesa/a7a3ac3a03fb8dd36a53c61d28635796 to your computer and use it in GitHub Desktop.
1. Create folder in home with the command line
|- ~> mkdir script-folder
|- ~> touch script-folder/custom-script-done
|- ~> sudo chmod 777 script-folder/custom-script-done
|- ~> nano script-folder/custom-script.sh
touch /home/{USER_FOLDER}/script-folder/custom-script-done;
** write the command line **
\- ~> sudo chmod 755 script-folder/custom-script.sh
# OPTION A (in boot process, sudo stuff, taking care the call-tail-order)
2.0. Create the script to load in boot
|- ~> sudo nano /etc/init.d/custom-script
#!/bin/bash
./home/{USER_FOLDER}/script-folder/custom-script.sh
\- ~> sudo chmod 755 /etc/init.d/custom-script
2.1. Create the links to load/kill the script when boot/shutdown
|- ~> sudo ln -s /etc/init.d/pjbridge-script /etc/rc3.d/S99pjbridge-script
\- ~> sudo ln -s /etc/init.d/pjbridge-script /etc/rc6.d/K01pjbridge-script
# OPTION B (in crontab, before boot, java stuff )
2. Open crontab with nano and add line
|- ~> crontab -e
@reboot sh /home/{USER_FOLDER}/script-folder/custom-script.sh
# END OPTIONS
3. Reboot
\- ~> sudo reboot
4. Check the file custom-script-done exists (and time
#|- ~> sudo lsof -i | grep command
|- ~> cd script-folder;
|- $> ls
\- Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment