Closed Thread
Results 1 to 7 of 7

Thread: Shell Script Help!

  1. #1
    SeanStar's Avatar
    SeanStar is offline Learning Programmer
    Join Date
    Nov 2009
    Posts
    32
    Rep Power
    0

    Shell Script Help!

    Hello, I'm running a server on a dedicated Linux server from the command line.
    I need a simple restarter to restart it every hour.

    Will this work?

    Code:
    #!/bin/bash
    while : ; do
    killall java
    java -Xmx192M server
    sleep 3600
    
    killall java
    java -Xmx192M server
    done
    I tried using cron... But I have no real sense of it.. It seems easy, but can it be run in the background as daemon?

    Sorry guys, but my brother is the one all about linux, I do use linux, but not much from the command line.

    Thanks.

    (I hope I don't look like a moron like others on this forums, Rofl.)

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    SeanStar's Avatar
    SeanStar is offline Learning Programmer
    Join Date
    Nov 2009
    Posts
    32
    Rep Power
    0

    Re: Shell Script Help!

    Meh - It doesn't seem to work in a one minute test, and my brother is sleeping -.-

  4. #3
    SeanStar's Avatar
    SeanStar is offline Learning Programmer
    Join Date
    Nov 2009
    Posts
    32
    Rep Power
    0

    Re: Shell Script Help!

    Issue resolved - I'm such an idiot.

  5. #4
    Join Date
    Jul 2009
    Location
    Santa Clarita, CA
    Posts
    2,111
    Blog Entries
    47
    Rep Power
    31

    Re: Shell Script Help!

    *Sigh* I just got here too. XD
    Wow I changed my sig!

  6. #5
    SeanStar's Avatar
    SeanStar is offline Learning Programmer
    Join Date
    Nov 2009
    Posts
    32
    Rep Power
    0

    Re: Shell Script Help!

    Yep, I got crontabs to work with daemon... Rofl, it wasn't even hard, but I'm a moron with the shell command.

  7. #6
    Hassan Seth is offline Newbie
    Join Date
    Dec 2009
    Posts
    10
    Rep Power
    0

    Re: Shell Script Help!

    Kindly.. POST in the solution...

    moreover... Please xplain about using CRON jobs.



    Regards.

    © Copy Rights. DE-Shell

  8. #7
    DesperD0s is offline Newbie
    Join Date
    Aug 2010
    Posts
    7
    Rep Power
    0

    Re: Shell Script Help!

    # root crontab
    # SYSTEM DAILY/WEEKLY/... FOLDERS
    @hourly ID=sys-hourly /usr/sbin/run-cron /etc/cron.hourly
    @daily ID=sys-daily /usr/sbin/run-cron /etc/cron.daily
    @weekly ID=sys-weekly /usr/sbin/run-cron /etc/cron.weekly
    @monthly ID=sys-monthly /usr/sbin/run-cron /etc/cron.monthly
    * * * 1,2,3,4,5 2-5 root [pathOfTheScript] - randomly

    If you need any further assistance, let me know.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [HELP] convert Perl script to Bash shell script
    By Egypte in forum Linux Programming and Scripting
    Replies: 2
    Last Post: 04-24-2011, 05:37 PM
  2. Shell Script and batch
    By SexYLinuX in forum Bash / Shell Scripting
    Replies: 4
    Last Post: 11-29-2008, 06:09 AM
  3. Using colors in Shell Script
    By ptt3 in forum Linux Programming and Scripting
    Replies: 1
    Last Post: 04-03-2008, 04:50 AM
  4. Learning Shell Script
    By Cosmet in forum General Programming
    Replies: 0
    Last Post: 11-14-2006, 06:16 AM
  5. Replacing with Shell Script and VI
    By Nightracer in forum General Programming
    Replies: 2
    Last Post: 11-05-2006, 07:18 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts