Can someone give me an example that shows how to put Cron commands into a script? Using these commands as an example:

find /home/network/public_1 -type f -ctime -1 -exec ls -ls {} \;
find /home/network/public_2 -type f -ctime -1 -exec ls -ls {} \;
find /home/network/public_3 -type f -ctime -1 -exec ls -ls {} \;

These commands work okay when I run them separately on CPanel's Cron menu. But they do not run when I put them together in a script and then try to execute the script as a single Cron job. The script probably requires different syntax, but I have not been able to figure out how to do this.

  • You may need to escape the backslash with another backslash. Alternatively use + instead of \; so that ls is executed with multiple arguments which is more efficient. Finally you could list all three start directories in one find command.
    – wurtel
    Sep 25, 2014 at 14:01
  • What do you mean by "escape the backslash with another backslash"? Can you give me an example? I tried starting the script with #!/bin/sh (suggested below) but that didn't fix the problem.
    – MaJ
    Sep 26, 2014 at 16:50

1 Answer 1


The script would need to be marked as executable by the cron process in the filesystem, and you would need to provide the full path to the script.

Also, you need to begin your script with this:


which tells the OS what to run as the interpreter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .