Find the answer to your Linux question:
Page 3 of 4 FirstFirst 1 2 3 4 LastLast
Results 21 to 30 of 36
ok, so if that script is working, time to put it in cron. follow my steps (1 - 3) from post #2 - just substitute the path to this script ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #21
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353

    ok, so if that script is working, time to put it in cron. follow my steps (1 - 3) from post #2 - just substitute the path to this script for /tmp/minecraft-cron.sh, or whatever i called it initially.

  2. #22
    Linux Newbie
    Join Date
    May 2012
    Posts
    115
    so this?

    1. cd into the system cron directory:
    Code:

    /etc/cron.d

    2. create a new file with an editor, call it "minecraft"

    3. in it, put the following:
    Code:

    # run minecraft cronjob every 5 min, send script output to log
    */5 * * * * root /root/cron_minecraft.sh > /tmp/minecraft-cronjob.log 2>&1


    to ts is like this:



    1. cd into the system cron directory:

    /etc/cron.d

    2. create a new file with an editor, call it "ts3"

    3. in it, put the following:
    Code:

    # run ts3 cronjob every 5 min, send script output to log
    */5 * * * * root /root/cron_ts3.sh > /home/joaogl/ts3/ts3/ts-cronjob.log 2>&1




    this?

  3. #23
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by Joaogl View Post
    # run ts3 cronjob every 5 min, send script output to log
    */5 * * * * root /root/cron_ts3.sh > /home/joaogl/ts3/ts3/ts-cronjob.log 2>&1
    if the script you've made is here:

    Code:
    /home/joaogl/Documents/ts3/ts3/ts-cron.sh
    then that is what you want to run. also, i assume you want to run it as your regular user, not root - is that true? anyway, just put whatever user you want it to run as where i've put "joaogl".

    here is what i think you want:

    Code:
    */5 * * * * joaogl /home/joaogl/ts3/ts3/ts-cron.sh > /tmp/ts-cronjob.log 2>&1
    here's a break-down of the above line:

    Code:
    */5 * * * *                     <-cron will call this script every five minutes
    
    joaogl                          <- run this script as user joaogl
    
    /home/joaogl/ts3/ts3/ts-cron.sh <- the script that will be run
    
    >                               <- redirect the output of the script
    
    /tmp/ts-cronjob.log             <- name of file where output is saved
    
    2>&1                            <- redirect STDOUT and STDERR

  4. #24
    Linux Newbie
    Join Date
    May 2012
    Posts
    115
    so like this?

    cd /home/joaogl/Documents/ts3/ts3
    nano ts3.sh

    Code:
    */5 * * * * joaogl /home/joaogl/ts3/ts3/ts-cron.sh > /tmp/ts-cronjob.log 2>&1

    save it and now?

  5. #25
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by Joaogl View Post
    so like this?

    cd /home/joaogl/Documents/ts3/ts3
    nano ts3.sh

    Code:
    */5 * * * * joaogl /home/joaogl/ts3/ts3/ts-cron.sh > /tmp/ts-cronjob.log 2>&1

    save it and now?
    no, forget the "cd" and the "nano" part - they are confusing you.

    just use crontab. be sure to run it as your regular user. run it with the "-e" parameter (e for edit). then enter the code:


    Code:
    */5 * * * * /home/joaogl/ts3/ts3/ts-cron.sh > /tmp/ts-cronjob.log 2>&1
    then save it. you probably need to enter the sequence :wq to "write" and "quit" the crontab editor (usually it is "vi").

    Edit: notice you are leaving out the username in the crontab code this time!

    Edit2: you can list your cron jobs with the "-l" parameter, e.g.:

    Code:
    crontab -l
    again, run it as the user who created the cronjob.

    after you've confirmed that it is there, look at the log in /tmp/ts-cronjob.log after 5 min have passed...
    Last edited by atreyu; 05-19-2012 at 08:13 PM. Reason: list cronjobs

  6. #26
    Linux Newbie
    Join Date
    May 2012
    Posts
    115
    Can you give me the commands to understand?

  7. #27
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Are you talking about understanding cron? In a terminal, make sure you are a regular user (not root), and run this command:

    Code:
    crontab -e
    This will edit the current crontab for the user that ran the command. It will open the crontab in an editor (probably vi). Press the i key to enter insert mode. You can tell because at the bottom of the terminal window, you should see -- INSERT --. Then you would type the crontab line as I instructed in post #25 above. Then you would press the <Esc> key to get out of insert mode, the press :wq to write and quit the editor.

    Once you are back in to your shell prompt, you can list the crontab like this:

    Code:
    crontab -l
    is that what you meant?

  8. #28
    Linux Newbie
    Join Date
    May 2012
    Posts
    115
    Ive done exactly like you but it says no crontab for joaogl

  9. #29
    Linux Newbie
    Join Date
    May 2012
    Posts
    115
    now its working .

    But how can i open the server with the anti-crash?

  10. #30
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by Joaogl View Post
    But how can i open the server with the anti-crash?
    er, what? by "open the server", do you mean start the TeamSpeak server? What do you mean by anti-crash?
    Last edited by atreyu; 05-26-2012 at 03:22 PM. Reason: quotes

Page 3 of 4 FirstFirst 1 2 3 4 LastLast

Posting Permissions

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