New answers tagged

0

Sometimes cron is working just fine but the script or command you want it to run just fails silently, causing you to bark up the wrong tree. In such cases I find it useful to wrap the target within another short script, which outputs some visible debugging code (including output of date) and use redirection to ensure I get some evidence to inspect. If the ...


0

OK, solution found by using rx_bytes and tx_bytes (received and transmitted bytes, can also use packets or check for dropped packets, see: http://xmodulo.com/measure-packets-per-second-throughput-high-speed-network-interface.html) The script: #!/bin/bash R1=$(cat /sys/class/net/eth0/statistics/rx_bytes) T1=$(cat /sys/class/net/eth0/statistics/tx_bytes) ...


0

That's because you have used relative paths in your script: duplicity ../learningbash file://../../../media/kingston This is working from terminal because you were in the correct directory where you should be to interpret the relative paths correctly. cron of an individual user sets the user's home directory as PWD. To solve the issue, use absolute path ...


0

To remove cron jobs belonging to another user: $ sudo su [-l] other-user-name # if other-user-name is a login user (option -l) # ^ ^ brackets indicate that you can just as well not use the option -l $ crontab -e ... suppress the cronjobs that you identify as dupes or superfluous ... quit your crontab editor. To remove root cron jobs: $ sudo -i ...


0

As per my understanding on this you can install Forever with NodeJs App. npm install -g forever forever start path/to/file/server.js forever list forever stop path/to/file/serverstopstart.sh or app name To see more help forever-service install --help To use it with Cronjob: touch serverstopstart.sh Edit vi serverstopstart.sh and paste below ...


0

I have just got this to work with the cinnamon desktop on Ubuntu 15.10, using the following recipe: if [ ! -v DBUS_SESSION_BUS_ADDRESS ]; then pid=$(pgrep -u $LOGNAME cinnamon-sessio) eval "export $(\grep -z DBUS_SESSION_BUS_ADDRESS /proc/$pid/environ)" fi notify-send "$RESUME" "$INFO" The trick was to realize that 'cinnamon-session' is too long for ...


1

This took forever to make work on ubuntu 15.10, Had to add a source to get the users normal env vars. my display was :1 for some reason as well. Using the gnome-session first results pid for DBUS_SESSION_BUS_ADDRESS lookup. # Crontab is * 21 * * * /bin/sh /home/tristik/cron.sh #!/bin/sh # cron.sh # Notifies the user of date and time source ...


0

Replace > ip.address.txt by > /home/jj/Desktop/IP/ip.address.txt


0

The reason the script runs when being executed from the shell but not as a cronjob is usually the different env it finds there. So change your cronjob to save the env in e.g. /tmp/env by using env | sort> /tmp/env and when /tmp/env arrives diff it with your current env. env | sort | diff - /tmp/env HTH


1

Change the perl entry to path/to/perl. Often times, commands such as perl and python are actually environment based things and are found in your PATH. As cron lacks that PATH, it's best to use absolute paths in crontab.


0

I never used it before, but just from reading the manual and some examples, I would try: wput --ascii "roofsmart_suitecrm_`date "+%m-%d-%Y"`.sql.gz" "ftp://$USER:$PASSWORD@$HOST/backup/" If you don't have wput yet on your computer, you can install it with: sudo apt-get install wput


0

One way to achieve what you desire is as follows: pkill scheduler.py python3 /path/to/scheduler.py You can also put it in a shell script. To stop the process: #!/bin/bash pkill scheduler.py exit 0 And save it as anyname1.sh To start the process: #!/bin/bash python3 /path/to/scheduler.py exit 0 Now, save it as anyname2.sh Then, run this ...


0

You can try the following commands in the terminal however it is highly recommended to just kill the service and restart it. /etc/init.d/SERVICE_NAME restart or service SERVICE_NAME restart


3

Use a control socket I just discovered what seems to be the most correct method from AutoSSH. However Multiplexing is a very big subject and can be used for other things. Source The idea in Bash script to setup... is to use and integrated method called Control Socket. Through this method you can command an old connection to die. However you will have to ...


1

The problem is solved. The problem was caused by the fact that I have edited the above mentioned /etc/tmpreaper.conf file by using a web-based text editor which is built-in into the "Parallels Power Panel" file manager, which, as it turned out, for some reason, uses a Windows-style line breaks (\r\n) instead of a Unix-style ones (\n). So the program was ...


0

If you have edited yr user's crontab, then suppress/erase the user name cyberbemon that precedes the long path leading to yr script. You do not need the user's name in there. If I am not mistaken you specify the user's environment with #! at the beginning, no just !. It may just be a typo in post or you forgot to escape the pound sign inside the code block, ...


0

This was a really bad issue by myself. If I did mail and looked the first mail with 1 then I saw the message /bin/sh: /root/jobs/log-crush-ftp-process.sh: No such file or directory I thought the whole time the error means the first column /bin/sh, but the real issue was that I renamed the jobs folder to bin. After changing the cronjob to */1 * * * * ...


0

The first problem I decided to solve by specifying amount of seconds for wake up time instead of explicit time. The second problem can be solved by specifying full path to the rtcwake. 30 23 * * * /usr/sbin/rtcwake -m off -s 25200


0

Given I've added the clearme.sh script in /etc/cron.hourly/ Just filter CRON tasks in terminal with the powerful egrep and awk: $ cat /var/log/syslog | egrep clearme | awk "{ print $1 }" > ~/Desktop/cronlog.txt The output will look like: Jan 14 15:20:01 markets-dev CRON[10089]: (dminca) CMD (root /etc/cron.hourly/clearme.sh) Jan 14 15:40:01 ...


0

To add a job to crontab: (crontab -u mobman -l ; echo "*/5 * * * * perl /home/mobman/test.pl") | crontab -u mobman - To remove a job from crontab: crontab -u mobman -l | grep -v 'perl /home/mobman/test.pl' | crontab -u mobman - Remove everything from crontab: crontab -r Nothing is tricky: - is STDOUT in Linux!


0

I use the following command to play a sound file: aplay ~/scripts/KenbeepBent.wav where KenbeepBent.wav is a sound file I keep in my ~/scripts directory so I can include it in bash scripts. I expect it would meet your needs.


0

You just need to use a text editor with root permissions sudoedit /etc/cron.daily/60sa-update or sudo nano /etc/cron.daily/60sa-update Make the change described, and then save the file and exit: for nano, that would be Ctrl+O then Ctrl+X



Top 50 recent answers are included