4

I'm seeing an error every time I do the command below. Why?

$crontab -l
no crontab for server

where server is the user account.

This issue comes about because the script in crontab doesn't work, so I've tried to break down the problem. This is what I have put in using crontab -e:

crontab -e
@reboot /usr/bin/teamspeak3-server_linux-amd64/ts3server_minimal_runscript.sh

I press ctrl + o and save it, reboot and find the script doesn't boot (even though the script itself does work if I double click it from the GUI). If I do a crontab -l after the reboot, I find I get the same error as above. Even before the reboot, if I try and open the crontab -e just after I saved this command inside of the file, the line of code isn't there.

11

That's probably because this user does not have a crontab, yet. You can create a crontab for this user by calling:

crontab -e
  • Ok I will update my question with some more info about my problem. Please, I beg you so much to help me fix it. – john smith Jun 28 '15 at 15:21
  • Ok I have updated my question to be more specific to the problem I'm facing. See if you can help. I'm really struggling here. – john smith Jun 28 '15 at 15:28
2

The user server does not have any schedule job in crontab so crontab -l outputs that information, not an error. Normally, you can find a user's crontab file in directory /var/spool/cron/crontabs.

  • The reason it doesn't is because I can't make a job in that file that it remembers. I've updated my post, please check it now. – john smith Jun 28 '15 at 16:37
  • After adding job to crontab, what is the result of crontab -l? @johnsmith – unsung Jun 29 '15 at 10:23
  • 2
    Hi I have fixed this now. It turns out the actual root cause of the problem was that I was using ctrl+z to close nano (sends process to background) rather than ctrl+x, so the cron job was not installing. – john smith Jun 30 '15 at 10:11
0

If you get the message "No crontab for username" type the following:

crontab -u username -e

You will be asked to select an editor from a menu. Then a default file will open.

Save the file without naming it.

To check that the file was successfully created type:

crontab -l
-1

Your crontab not run. You need to run your command on the root with 4 steps:

Step 1: crontab -e
Step 2: o (o in alphabet)
Step 3: Fill your command. Ex: */2 * * * * root /usr/local/auto/restart.sh >/dev/null 2>&1 
Step 4: Exit

ESC :wq Enter

Review your CMD –> crontab -l . It was saved here(/var/spool/cron)

Source: https://thuthuatcaidat.com/sua-loi-no-crontab-for-root/

  • This actually doesn't answer the question since author ot the question already performed these steps – mrc02_kr Jun 25 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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