New answers tagged

0

Are you sure you are using your private key and not just trying to ssh with sana user? Take a look at https://support.rackspace.com/how-to/logging-in-with-an-ssh-private-key-on-windows/ in this section "PuTTY: Logging in with the Private Key" Note: In future whenever you try to change your ssh configuration, leave one ssh session open and check your ssh ...


1

This is a really wild guess, but the include might be failing because of directory/file permissions. Make sure that the user you are running the cron job for has all rights to access the directory where cron.php file is and all the files that it opens. You might have tweaked the permissions for the webserver that runs under www-data, but you are running ...


0

As others have mentioned your cron daemon is working correctly but PHP is having problems finding the required files that cron.php requires to execute. PHP looks for these in the include paths specified by php.ini and additionally in the document root for the apache module thus why the site itself works, for the command line version of PHP this additional ...


0

"No MTA installed" means that in your script, you might want to send an email, but no MTA (Mail Transfer Agent) have been specified. The cron daemon tries in fact to send outputs to you. You can install an MTA (like postfix), or, if outputs are not important, redirect to" /dev/null 2>&1"


2

XFS provides a filesystem defragmentation utility, xfs_fsr that can defragment the files on a mounted and active XFS filesystem. It can be useful to view XFS fragmentation periodically. xfs_fsr improves the organization of mounted filesystems. The reorganization algorithm operates on one file at a time, compacting or otherwise improving the layout of the ...


0

Create a script (and chmod +x it): #!/bin/bash export DISPLAY=:0 firefox Run crontab -e and add at the bottom: * * * * * /path/to/my/script ..and it'll open Firefox every minute on your user's desktop. Figured you might also want a feature to automatically close it after some time, instead of incrementing opened windows or tabs. I would suggest ...


0

You can try using watch. watch -10 <YOUR COMMAND> This will try executing your command every 10 second in terminal.


1

Use full path, for example: /sbin/reboot


0

Try shutdown instead of reboot and see if it helps. Shutdown drops into single user mode to perform the run level change. # m h dom mon dow command 10 00 * * * /sbin/shutdown -r now Also, make sure you are editing root's crontab: sudo -i crontab -e


1

PHP Fatal error: require(): Failed opening required 'app/bootstrap.php' (include_path='.:/usr/share/php:/usr/share/pear') It looks like your required files cant be found and so it is throwing the error. I presume these files are in /var/www/html/sitename/app/? In this case add the following line at the beginning of your cron.php: ...


1

Sorry to tell you , but you are wrong ;) Your cron is working - but your php code throws errors. consider either updating this post or Mark this post as answered and create a new one or delete this post and create a new one with a better description of your problem


1

Use crontab -e to open your crontab file. Then add: 0 3 * * * rsync -raz --remove-source-files 'user:password@remotehost:/directory/to/copy' '/local/destination/directory/' This tells cron to run this command every day at 3 AM. Adjust the first 5 parameters (0 3 * * *) as necessary to adjust the time when this runs and how often it runs The rsync command ...


0

Use following command to edit your cron job: crontab -e Then add following to the end of that: 0 0 * * * lftp -u username,password -e "your command;quit" ftp.site.com Obviously you must install lftp package beforehand.


2

Do you type this in a terminal ? This is a cronjob definition, not a command. This line has to go in /etc/crontab The user is also missing... I think you copy this from another site without really understanding how it works. If yes, read some documentation about cron...


5

About cron Quoting wikipedia here The software utility Cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals. It typically automates system maintenance or ...


4

Use \% instead of % - cron uses % as a newline.


14

cron treats % as newlines. You need to use escape it i.e. use \% to get literal % as used in date. So you need: date +"\%Y\%m\%d\%H\%M" Or you can use a script and use all the commands in the script and call the script from crontab. From man 5 crontab: Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into ...


2

Remove the dot in your crontab entry like this: */1 * * * * /home/usr/automation/check_rejected_files.sh > /home/usr/automation/cronout


0

You can change the from address using mailx. Mailx is a Unix command line utility used to send emails from the command line. It is just a newer version of the mail command. If you do not have mailx, you can get it by running sudo apt-get install mailutils To send an email with a different from address, use mailx like this echo 'This is the email body.' ...


1

If you log in with ssh keys rather then a password, one easy approach would be simply to rename .ssh/authorized_keys on Friday evening and return it on Monday morning. Using cron, of course. The downside with this if that there is no failsafe (if the job on Monday morning fails to run then you're potentially locked out all week).


0

Try using full paths and avoid using sudo in cron jobs. For instance, change "BASEPATH" and try: find /BASEPATH -name "*.mkv" -execdir sh -c \ 'ffmpeg -y -i "{}" -vcodec copy -acodec ac3 "$(basename "{}" .mkv).mp4"' \; The sh -c, instead of -exec (or -execdir), makes basename work ok, and avoids the double extension ".mkv.mp4" in: find /BASEPATH -name ...


0

sudo gedit /etc/crontab Add the following line to the bottom of the document: 00 * * * * MYUSERNAME bash /path/to/my/file &> /dev/null This will run the /path/to/my/file with bash every hour, if you want to change the frequency, read more about CronTab. As for email sending, that is a much larger setup for another question, that has already ...


0

[Option #1] Assuming you are referring to logging in over SSH into your specific work computer - the best way would be to just shut down your work machine over the weekend. [Option #2] Your script could append the host file and reroute your servers address to local host. There is an example application called "SelfControl" that does this, but it's written ...


2

As specified in man 5 crontab, which contains the format of crontab files: Instead of the first five fields, one of eight special strings may appear: string meaning ------ ------- @reboot Run once, at startup. @yearly Run once a year, "0 0 1 1 *". @annually ...


0

As far as I understand it .... anacron is not a daemon and is ran by cron. cron runs at boot and runs anacron. anacron checks to see if something its programmed with has missed its schedule and runs it. Since this is the way I see it ... it would seem that you would want the daily job set in anacron. As for hourly in anacron .. I also haven't seen anything ...


1

I have following lines end of my backup script to send email out with log gathered before. mailbody=${log} echo "From: Backup xx <backup@gensand.box>" > /tmp/backupmail echo "To: gen@riddi.eu" >> /tmp/backupmail echo "Subject: [BACKUP] Failure report for $(hostname)" >> /tmp/backupmail echo "" >> /tmp/backupmail cat ${mailbody} ...


2

Further to Ikar's answer, we have also seen this on a VPS provider using https://openvz.org/. We addressed it by running this bash script: for script in $(find /etc/cron.* -type f -name '*.disabled' ! -name '.placeholder*') do mv "$script" "$(dirname $script)/$(basename $script .disabled)" done which simply strips all the ".disabled" off the ...


1

The script bellow uses two calls to dbus and one while loop to poll for the percentage. Very simple and effective setup. Run this when you want to shutdown the laptop once it is charged #!/bin/bash get_percentage() { qdbus org.gnome.SettingsDaemon.Power \ /org/gnome/SettingsDaemon/Power \ org.gnome.SettingsDaemon.Power.Percentage } ...


1

Try this python script. It borrows from Saving work automatically when battery is low #!/usr/bin/env python import subprocess import dbus sys_bus = dbus.SystemBus() ck_srv = sys_bus.get_object('org.freedesktop.ConsoleKit', '/org/freedesktop/ConsoleKit/Manager') ck_iface = dbus.Interface(ck_srv, ...


2

/etc/crontab is root's crontab. crontab -e edits the crontab for the current user.


0

Immediately I'm noticing that your command @reboot rtl_tcp || sleep 4 || ./go/bin/rtlamr -logfile=/home/ubuntu/log.json uses an OR list operator (the || symbols). It does this: An OR list has the form command1 || command2 command2 is executed if and only if command1 returns a non-zero exit status. So the sleep 4 command will only be run ...


0

Welcome to AU ! This seems to be a case of display (or stdout) not being correctly identified by yr user's cron environment (as is normally the case for all gui applications). You will find a lot of Q/A on that subject in AU and StackExchange at large. Solution: In user otto's crontab, modify yr job entry for it to read: @reboot DISPLAY=:0 ...


1

An easier way would be to put your startup commands in a script, and invoke that: # You could put the file in any other directory that is mounted # early in boot time (not your HOME directory) cat >>/var/local/foo <<EOF #!/bin/bash # Suggestion: use absolute path: /usr/local/bin/rtl_tcp rtl_tcp sleep 4 # Warning - MUST specify absolute path! ...


0

I was confusing things. The /etc/cron.d/rsnapshot file came with the rsnapshot package, it was not created by the crontab command (hence, why it had a different schedule). It is not necessary to use the crontab command at all, simply edit the /etc/cron.d/rsnapshot, this works fine.


0

To proof, that crons are starting: Make a cron like @reboot touch file and find / | grep file. It will exist.


0

Maybe the more efficient is to use the reboot parameter in your crontab with the line like that: @reboot /home/user/script.sh It will launch the script every time the server boot. I use that on several servers to send me a mail when it boots.



Top 50 recent answers are included