crontab is too long; maximum number of lines is 1000 - cron

crons not running due to the issue on the crontab file for a user. I have shell script that will update the crontab for a user. However, currently running that shell script is giving me the following error The issue is experienced only on ubuntu 18.04 version. Other Debian 10, 11, ubuntu 20 machines are working fine with the same crontab
crontab is too long; maximum number of lines is 1000
I am not sure what is causing the issue. Could someone please help

Related

how to restart appication over cron.daily in Fedora 33

I am using Fedora 33 and I have script, which I am trying to make working.
but without success ;-(
it is given to /etc/cron.daily
#!/bin/bash
RESTART="/bin/systemctl restart saslauthd"
it is very simple. I have known problem with SASLauth if You are using MariaDB.
it will crashed sometimes in one week, sometimes one month, but sometimes crash
I have added this script file to cron.daily and rights is 100755 - standard for all other scripts
where can be bug ?? all other scripts are working
is there some limitation for running services by cron ?? /I have added in "sudoers" also "cron ALL=(ALL) NOPASSWD: ALL"

Crontab stopped working suddenly, no errors

I have had two scripts running via crontab for a while now. Suddenly, it stopped working. This is on a RaspberryPi, and this is all it does, so I haven't installed new software, etc. (The only thing that updates is the sudo apt-get update and ... upgrade commands.
Here's my only crontab command:
...
# m h dom mon dow command
31 14 * * * python /mnt/ExternalDrive/FolderA/my_file.py
Nothing seems to happen. I don't believe the file runs. At 14:31, I ran pgrep -l python to see if python was running, and it doesn't return anything.
In my_file.py I have tried both shebangs, #!/usr/bin/python or #!/usr/bin/env python3.
When I do which python, I get: /usr/bin/python.
I have looked all over, and restarted crontab, etc. but it doesn't work. I've also set the permissions on the file, and installed postfix to no avail.
Running grep CRON /var/log/syslog and I see (CRON) info (No MTA installed, discarding output), but am not sure if that affects this.
I even deleted the crontab file, restarted the computer/Pi, and re-created one (sudo crontab -e).
Again, this was working fine before, but suddenly doesn't. Running the script from the terminal works fine (python /mnt/.../my_file.py)

Pcmanfm set wallpaper fails on Raspbian stretch in cron

I am running a nearly fresh image of Raspbian Stretch 4.9 with a desktop and have a program which creates a new image for the computer background every few minutes.
I am trying to create a cron job to properly update the background using pcmanfm and, having followed the suggestions here, have created the following script called update.sh to set the background:
!#/bin/bash
export DISPLAY=:0
export XAUTHORITY=/home/pi/.Xauthority
pcmanfm -w '/home/pi/folder/image.png'
The script is executable and when it is run from the terminal it functions as intended. I have created a crontab to have this run automatically as such:
* * * * * /home/pi/folder/update.sh > /home/pi/folder/log.txt 2>&1
When the cron job triggers every minute, a pop-up window appears with an error saying "Desktop manager is not active." with a button "OK" to dismiss it, and the log file reads:
** Message: x-terminal-emulator has very limited support, consider choose another terminal
I have tried the command directly in the crontab
* * * * * DISPLAY=:0 && pcmanfm -w '/home/pi/folder/image.png' > /home/pi/folder/log.txt 2>&1
And the error is different this time
Cannot open display:
I am not entirely sure what sense to make of this, though from looking around it seems cron jobs can be finnicky. I am not sure if it is a Path or environment problem because I do not know many details about these things, but I don't think it should be a problem as I am using the full path to the image and the scripts. It shouldn't be a permissions error, because I have tried this on both a user crontab and a system crontab, and both fail. (Besides, the default pi user has root permissions by default anyways.) I am not sure what else to search for or try so I am asking for help if someone could point me in the right direction or has encountered this problem before.
I had exactly the same issue, except I am running Lubuntu 17.04. It appeared lately after a recent update, though cannot pinpoint when. After lot's of research I became suspicious that one of the XDG enviromental variables must be exported too. Following some trial and error, I found that exporting XDG_RUNTIME_DIR solved the problem for me. You may want to give it a try.
To figure out the value run: echo $XDG_RUNTIME_DIR
The working wallpaper changer running from cron for me now looks like:
#!/bin/bash
...
export DISPLAY=:0
export XAUTHORITY=/home/krisz/.Xauthority
export XDG_RUNTIME_DIR=/run/user/1000
pcmanfm --set-wallpaper=${dir}/${file} --wallpaper-mode=crop
...

#reboot via crontab isnt working

IM running a VPS server on Ubuntu 14.04 minimal x86. I connect to it using putty via SSH.
On the server i have a simple script that is starting a few instances of bots
nohup node /nodebots/bot10/server.js &
I use root as a user, so all the privileges and +chmod X are set properly (in my opinion)
The idea is that my node.js program is not excelent + the service im running the bots for sometimes has reboots, server crashes etc.
Ive installed crontab and at this moment struggling to set the script to be run at boot.
Ive used various solutions including trying to boot it via init.d , adding a line to rc.local and well using crontab -e. None of it helps.
Currently the code in crontab looked the following ways
`#reboot sh /nodebots/botsrun.sh`
#reboot root /nodebots/sh botsrun.sh
#reboot cd /nodebots/ && sh botsrun.sh
None of it helped.
Im new to Ubuntu, coding and even terminal commands. I would really apreaciate any kind of help. I will be more then grateful for a step by step tutorial on what im doing wrong and what should be done.

running cronjobs from plesk

I have Plesk (or more accurately Parallels Small Business Panel) installed on my linux server. However, my knowledge of linux is pretty limited. I am trying to set up a cronjob that will run a php file.
I have found the scheduled tasks area in plesk and filled in the details for when i want the script to run e.g. 30 9 * * *. However I seem to be having difficulty writing the correct command. I am using:
usr/bin/php -q /var/www/vhosts/mywebsite.co.uk/httpdocs/admin/file_to_run.php
I have checked that the location of php is correct using:
whereis php
I have also checked that the path to the file is correct using:
find / -name 'file_to_run.php'
However the php page is not doing it's job at the specified time. Can anyone help me get to the bottom of this?
Two possibilities
1) Check if the script has an error by doing a dry run on the command line.
Because you will not see this error when the cron user runs the command.
2) Perhaps you want the output to go to a specific file?
You can redirect it as such :
usr/bin/php -q /var/www/vhosts/mywebsite.co.uk/httpdocs/admin/file_to_run.php > /your/destination/the_output
Unless your php script handles everything it needs on the inside, that is.

Resources