Run multiple commands in one cron job

You can separate two or more commands with semicolons (;),
Semicolon (;): is used to separate multiple commands. This causes all commands to be executed without checking the exit status of previous commands.

We can separate two or more commands with a semicolon, which do not require checking the exit status of the previous command. E.g, you need to change the permissions of all files to 777, but you have to set 777 for the logs directory.

The cron command will look like this:

Use this command, if you want to run the next command only then, when the previous one was successful (exit status 0). For example, you want to run backup.sh after successfully navigating to the / backup directory.

How useful this post was?

Click on the star, to evaluate it!

Average grade / 5. number of votes:

So far, no votes! Be the first to rate this post.