Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

2 Answers

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

share|improve this answer
    
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
add comment

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.