User Tools

Site Tools


run_program_at_boot_using_cron

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
run_program_at_boot_using_cron [2017/01/31 17:12] walkeradminrun_program_at_boot_using_cron [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 3: Line 3:
 \\  \\ 
 \\  \\ 
-{{:pocket_watch.jpg?300|}}+{{:pocket_watch.jpg?200|}}
 \\  \\ 
 +
 +----
 +
 ===== Introduction ===== ===== Introduction =====
 I was using the .bashrc file when logged in as a user (from your home directory, type sudo nano .bashrc) to launch scripts upon the Raspberry Pi bootup. However, while this works, its has one really annoying issue. If you login from another place, say from SSH, then the script runs again, which isn't great for my application. I was using the .bashrc file when logged in as a user (from your home directory, type sudo nano .bashrc) to launch scripts upon the Raspberry Pi bootup. However, while this works, its has one really annoying issue. If you login from another place, say from SSH, then the script runs again, which isn't great for my application.
Line 16: Line 19:
 \\  \\ 
 To avoid putting loads of commands in to Cron, its best to group them all in to a file, then just reference that file in Cron. For this example we will make a file called <color red>launcher.sh</color>. To avoid putting loads of commands in to Cron, its best to group them all in to a file, then just reference that file in Cron. For this example we will make a file called <color red>launcher.sh</color>.
-\\  
 \\  \\ 
  
Line 61: Line 63:
 sudo chmod 755 launcher.sh sudo chmod 755 launcher.sh
 </file> </file>
-\\ 
  
 ---- ----
Line 105: Line 106:
 @reboot sh /home/pi/launcher.sh >/home/pi/logs/cronlog 2>&1 @reboot sh /home/pi/launcher.sh >/home/pi/logs/cronlog 2>&1
 </file> </file>
-\\  
 \\  \\ 
 When you boot/reboot your Raspberry Pi, this will now run the launcher.sh, and if necessary, output any errors in the logs folder. When you boot/reboot your Raspberry Pi, this will now run the launcher.sh, and if necessary, output any errors in the logs folder.
run_program_at_boot_using_cron.1485882722.txt.gz · Last modified: 2023/03/09 22:35 (external edit)