Alexandre34
Posts: 21
Joined: Sun Jan 31, 2016 6:18 am

update script at boot

Sat Mar 19, 2016 7:41 am

Hello
I am newbie with Linux (raspian jessie), and need an advice:
How make this task done at boot:
IF file /home/pi/ftp/player_new exists
THEN copy /home/pi/player in /home/pi/player_old
THEN copy /home/pi/ftp/player_new in /home/pi/player
THEN remove /home/pi/ftp/player_new
THEN give execute rights to /home/pi/player

I knows the commands to use (sudo,cp,rm,chmod)
What I dont know is the "logic" part (if, then) and the proper way to execute this script at boot time
If an advanced user have an advice...

DirkS
Posts: 10347
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: update script at boot

Sat Mar 19, 2016 10:29 am

See e.g. http://ryanstutorials.net/bash-scriptin ... ements.php for info on the if statement.
There are options for checking the existence of files, directories, etc (also mentioned on linked page).

I wouldn't bother with auto-starting until you get the script itself working.

Return to “General programming discussion”