Run shell scripts in order

Midimo

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.

Robert Northard

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Run shell scripts in order

From Dev

Run sql scripts in numeric order

From Dev

Run sql scripts in numeric order

From Dev

Can't run shell scripts

From Dev

run shell scripts in a sequencing way?

From Dev

Run shell scripts through a website

From Dev

How to run Spring Shell scripts in a JUnit test

From Dev

How to run multiple shell scripts in parallel?

From Dev

Is there a text editor that can run shell scripts?

From Dev

Is there a text editor that can run shell scripts?

From Dev

Start two scripts that run indefinitely in shell script

From Dev

Run gnuplot scripts in background within a shell script

From Dev

Oozie run shell scripts on random nodes

From Dev

Writing shell scripts that will run on any shell (using multiple shebang lines?)

From Dev

Find all shell scripts from a folder and execute them in order

From Dev

Run-time code generation in Linux shell scripts

From Dev

How do I run bash shell scripts in cygwin?

From Dev

Creating and executing shell scripts to run XAMPP on double click

From Dev

How to create a service or shell scripts to run a project within virtualenv?

From Dev

Creating and executing shell scripts to run XAMPP on double click

From Dev

Run-time code generation in Linux shell scripts

From Dev

How do I run bash shell scripts in cygwin?

From Dev

How do run MYSQL scripts from a shell script with bash variables?

From Dev

Why do some Linux shell scripts use exec to run commands?

From Dev

Need to update shell scripts so they can run in different *nix flavors

From Dev

Run multiple shell scripts sequentially using the source command

From Dev

shell file opens terminal and run a sequence of commands in specific order

From Dev

shell file opens terminal and run a sequence of commands in specific order

From Dev

How to combine two batch scripts, put them into one batch file and run them in descending order

Related Related

  1. 1

    Run shell scripts in order

  2. 2

    Run sql scripts in numeric order

  3. 3

    Run sql scripts in numeric order

  4. 4

    Can't run shell scripts

  5. 5

    run shell scripts in a sequencing way?

  6. 6

    Run shell scripts through a website

  7. 7

    How to run Spring Shell scripts in a JUnit test

  8. 8

    How to run multiple shell scripts in parallel?

  9. 9

    Is there a text editor that can run shell scripts?

  10. 10

    Is there a text editor that can run shell scripts?

  11. 11

    Start two scripts that run indefinitely in shell script

  12. 12

    Run gnuplot scripts in background within a shell script

  13. 13

    Oozie run shell scripts on random nodes

  14. 14

    Writing shell scripts that will run on any shell (using multiple shebang lines?)

  15. 15

    Find all shell scripts from a folder and execute them in order

  16. 16

    Run-time code generation in Linux shell scripts

  17. 17

    How do I run bash shell scripts in cygwin?

  18. 18

    Creating and executing shell scripts to run XAMPP on double click

  19. 19

    How to create a service or shell scripts to run a project within virtualenv?

  20. 20

    Creating and executing shell scripts to run XAMPP on double click

  21. 21

    Run-time code generation in Linux shell scripts

  22. 22

    How do I run bash shell scripts in cygwin?

  23. 23

    How do run MYSQL scripts from a shell script with bash variables?

  24. 24

    Why do some Linux shell scripts use exec to run commands?

  25. 25

    Need to update shell scripts so they can run in different *nix flavors

  26. 26

    Run multiple shell scripts sequentially using the source command

  27. 27

    shell file opens terminal and run a sequence of commands in specific order

  28. 28

    shell file opens terminal and run a sequence of commands in specific order

  29. 29

    How to combine two batch scripts, put them into one batch file and run them in descending order

HotTag

Archive