The scripts can be placed in a location where it’s defined as $PATH such as /usr/local/bin or ~/.local/bin
- shell scripts can be renamed without extension (it will run as shell as long as shebang is present)
- now we are able to run this script in anywhere in the system
Script Scheduling
at command
Schedule a command to run at specific time.
at 12:34 -f myscript.sh-fspecify the script file to run
atq
12 Thu Jun 27 17:00:00 2024 a karis
atrm 12 # the id of the commandatqlist all the queued commands with a numberatrmfollowed by the number remove the command
cron
- it’s good idea for a cron script to use full path of the command
/usr/bin/echoinstead of `echo
1 2 3 4 5 command_to_run # run on April 3 and all Fridays during April at 2:01 AM- minute, hour, day of month (0-30), month (0-12), day of week (1-7)
*means it will run at all the time