Any Shell Coders Out There?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RainMailer
    Confirmed User
    • Feb 2003
    • 826

    #1

    Any Shell Coders Out There?

    Hey guys! I would like to write a shell script that opens sub shells to run multiple commands at one time. What i need the script to do is start for ex: 1.php then 2.php then 3.php . Can anyone help?

    Thanks in Advance!
    harbinc at gmail dot com
  • grumpy
    Too lazy to set a custom title
    • Jan 2002
    • 9870

    #2
    explain a bit more...maybe i can help.
    Don't let greediness blur your vision | You gotta let some shit slide
    icq - 441-456-888

    Comment

    • RainMailer
      Confirmed User
      • Feb 2003
      • 826

      #3
      I have 5 php scripts that I would like to code a shell script to run all the php scripts at the same time. I am going to create a cronjob to run the shell script instead of creating a cronjob to individually run each php script.
      harbinc at gmail dot com

      Comment

      • NetRodent
        Confirmed User
        • Jan 2002
        • 3985

        #4
        Depending on your shell...

        #!/bin/sh
        /path/to/php /path/to/1.php
        /path/to/php /path/to/2.php
        /path/to/php /path/to/3.php
        "Every normal man must be tempted, at times, to spit on his hands, hoist the black flag, and begin slitting throats."
        --H.L. Mencken

        Comment

        • Brujah
          Beer Money Baron
          • Jan 2001
          • 22157

          #5
          use run-parts and put them all in a directory, executable?

          15 6 * * * run-parts /home/path/daily

          Comment

          • com
            Confirmed User
            • Aug 2003
            • 4541

            #6
            Originally posted by NetRodent
            Depending on your shell...

            #!/bin/sh
            /path/to/php /path/to/1.php
            /path/to/php /path/to/2.php
            /path/to/php /path/to/3.php
            what he said, then cron it

            Real. Professional. Hosting.
            .:Expect Nothing Less:.
            320-078-843 :: www.realprohosting.com :: [email protected]

            Comment

            • Big E
              Registered User
              • Mar 2002
              • 935

              #7
              I think he said at the same time.. ?

              Just add an ampersand after each command to put it in the background:

              command &

              You might need to redirect the output (check your shell man page):

              command 2>&1 >/dev/null &

              Comment

              Working...