0

I have three different jobs that I want to run from the FreeBSD shell. I would like to consolidate them into a single script, if possible, but I can not find any syntax to do that. Is there someway I can accomplish this?

Daryl
  • 11
  • 1
  • 1
  • Why not create a shell script which just calls them all? – Josh Mar 18 '13 at 13:26
  • 3
    This question needs a lot more information for anybody to be able to help you. What do you mean by "different jobs"? What have you tried? What has failed, and how? – Jenny D Mar 18 '13 at 13:27
  • There are a myriad of was to run multiple "jobs", simplest of all is end the command with a ; then type the next one, etc. – NickW Mar 18 '13 at 13:27
  • I apologize for not being descript. I have 3 different commands I want to run at different times. I want to have all three commands be in a single script, but still have cron run them at different times. – Daryl Mar 18 '13 at 13:36
  • And to add to that, I need to use multiple variables and, from an administrative standpoint, would be much easier handled from a single shell script rather than calling multiples. – Daryl Mar 18 '13 at 14:00

2 Answers2

3

you can use article "&" for parallel work and "&&" step-by-step launch script

#script.sh & script2.sh & script.sh

more info at http://www.gnu.org/software/bash/manual/bashref.html#Lists

Rainbow-
  • 81
  • 7
  • You can also run multiple commands by separating them with `;` which will rul all the commands regardless of their return value. `&&` will only continue to run if the previous command was successful. – Josh Mar 18 '13 at 13:33
0

crontab itself runs multiple cronjobs from a single file called crontab.

0 * * * * /home/username/script.sh
0 * * * * /home/username/script1.sh
0 * * * * /home/username/script2.sh
MangeshBiradar
  • 1,820
  • 4
  • 16
  • 17