I have 3 commands that I am trying to run when the system start as a cronjob.
# Sleep at startup
sleep 2m
#command num 1:
./trace.out
sleep 5
#Command num 2:
java -jar file.jar
sleep 5
#Command num 3:
sh ./script.sh
is there any way to make this script more efficient using a loop, some way to make sure every script is running before executing the next one.
I would use && between each command as it executes each command, only if the previous one succeeded! For example:
# Sleep at startup
sleep 2m
./trace.out && java -jar file.jar && sh ./script.sh
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments