New answers tagged

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.


0

If you want to either autostart or cancel autostart for any given app upon login, You can: A) go to the Dash, and open "Startup Application". Select the application you want to not autostart anymore and hit the button "Remove". or B) go to yr terminal (CTRL+ALT+T) and type: $ cd ~/.config/autostart ; ls -AF # check that you see the file ...


2

You need to specify what your default output display is. (Sorry, the above reference is in German. I could not find anything else.) A) In the cmd field, introduce: either DISPLAY=:0 /usr/bin/notify-send test or export DISPLAY=:0; /usr/bin/notify-send test and report on result in a comment below if needed. B) You may also try running ...


0

Create a file: /etc/cron.monthly/backups.sh make it executable by: $ chmod +x /etc/cron.monthly/backups.sh to tidy it up, create a variable: DATE=`date +%Y.%m.%d-%H.%M.%S` # eg. 2016.04.22-13.01.59 And then reference your command above with: /bckupftp/backup${DATE}.tar.gz It would produce a file similar to: ...


4

To set up the cronjob for yr present non-root user, do in terminal: $ crontab -e The above will open yr (non-root) user's crontab with his/her default editor. Alternatively, to do so for the root crontab, but with yr present (presumably non-root) user environment parameters (default editor, etc.): $ sudo -i crontab -e In yr opened crontab, enter a new ...


0

So I like to make backups using a bash script like this DATE=date +%Y%m%d-%H%M tar -jcvf /home/backup/myfiles-$DATE.tBz2 dirtobackup1 dirtoback2 If you want you can run something like this to clean it up find /home/backup/ -ctime +2 -exec rm {} \; This has a number of advantages over what you are asking. Backups are compressed and in files. Since ...


2

If you look into your ~/.bashrc file youll find the alias which defines alert. # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' Example: Try as input in ...


0

Your script looks ok. You should add exit 0 / exit 1, for failure / success .. more info below. and it will be checked with every 20 minutes If the script should run always, each 20 minutes in the background, you should use cron, which is already available on your system. Like that all output of your script will be mailed to root, if the script ...


1

Use a while loop with read to get each IP address and then use ping: #!/bin/bash while IFS= read -r ip; do if ping -q -c2 "$ip" &>/dev/null; then echo "$ip is Pingable" else echo "$i Not Pingable" fi done <"$HOME"/iplist.txt


1

If you don't want to install an MTA (which I currently have no need for) you can pipe the results of the cron job to a log file. sudo crontab -e then with your cron job would look like this. 0 3 * * * /cmd/to/run >> /var/log/somelogfile.log then you can just tail the log and see what happened sudo tail -f -n 50 /var/log/somelogfile.log This is ...


0

Fixing SSH problem You can't authenticate remote machine with public key, you need to use private key to do that. Public key has to be at remote server. If you're not sure, then just copy public key to remote server like that: ssh-copy-id -i ~/.ssh/id_rsa.pub username@remoteserver and then run your command with private key: ssh -N -f -R ...


1

Try without the && 00 15 * * * export DISPLAY=:0 /path/updater.sh I hope this helps


0

"System" cron jobs are run through the /etc/crontab file, not through the root user's crontab file /var/spool/cron/crontabs/root, which is what sudo crontab -e edits. /etc/crontab on my Ubuntu 14.04.3 system is (Note the informative #comments): # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to ...


1

You need to capture the elusive crontab output so you can see what it is complaining about. Add -x to your shebang for verbose output in your script: #!/bin/sh -x Set the cron job to execute more frequently while you troubleshoot it: */1 * * * * root /home/absolute/runsikulix -r /home/absolute/auto/test.sikuli Crontab should be logging to ...


0

As pointed out in a comment above, the most obvious pbm is that you are not using the -O option correctly. Look up man wget in terminal. Here is an extract: -O file --output-document=file. The documents will not be written to the appropriate files, but all will be concatenated together and written to "file". If - is used as file, documents ...


4

User crontabs are stored in /var/spool/cron/crontabs/. You can't use the crontab command to see or edit the system crontab /etc/crontab. Note that only the system crontab contains a user field after the date. User crotab entries are always run the corresponding user so they don't need an user field.


2

This is normal. When you add lines on the /etc/crontab it's not really attribuate to a profile but the system. If you want to add a crontab to an user: crontab -e -u <user> The users' crontab are stored on the folder /var/spool/cron if you want to see the files.


2

No, you are using TWO different systems. crontab -u <user> -l will list all jobs added with crontab -e. /etc/crontab is not part of crontab but from another procedure. Both are there for historical compatibility. And the big difference is permissions. User cron jobs will run with the permissions of that user, system cron jobs run with the ...


0

The easiest way I've found is using the pidof command: renice <new niceness> -p $(pidof <process name>) found from: http://www.commandlinefu.com/commands/view/4614/renice-by-name For your situation, probably put that command into crontab -e (as root) with whatever period you want (say every 30 mins). It seems like you should find the root ...


3

You're right, you can't edit the crontab in Snappy Ubuntu Core. Personally I just create a service that sleeps. For instance, say there was an operation you wanted to run every 15 minutes. Put it in a shell script named my_service.sh: #!/bin/sh while true; do do_my_thing sleep 15m done Make it executable. Now create something like the following ...


0

Could doesn't work because tv_grab_uk_rt option -output is wrong. Right option is --output <file> (use 2 dashes instead of 1). You can look at related man page. Update If you want to run a cron script every tot minutes (e.g. 5) you can use the following command: */5 * * * * <script_file>


0

I have set something similar. I use the GMAIL command line sending, then I have setup a script that gets my public IP, then emails it to me and texts it to me. First, I setup GMAIL to send via command line by following this answer here: http://askubuntu.com/a/522434/231142 Next, I created a script and I called mine getintip.bsh and I put it in my Home ~ ...


0

I would use polling technique for the pid of that script. Basic idea is wait until the script releases the PID (meaning it has exited), and only then go to the next step in the reboot script. And of course if no process is running, the script will go on to reboot. #!/bin/bash while pgrep -f my_backup_script_name.sh > /dev/null do sleep 0.25 # small ...


0

You can do what you want with one single command, with caveats. Read on. NOTICE: What follows is almost integrally quoted from this archlinux.org wiki. I introduced just a few changes in wording and format here and there, but nothing substantial. All the merit definitely goes to maintainers of and contributors to the excellent wiki.archlinux.org. This ...


0

Since you are familiar with PHP you can make a PHP daemon/service. I have made a PHP service for myself once because I had to use a library that was available only in PHP. It runs without any issue for many years now. Here are some information about PHP daemons: https://github.com/shaneharter/PHP-Daemon http://kvz.io/blog/2009/01/09/create-daemons-in-php/ ...


1

You could use a simple shell-script for that: #!/bin/bash while true; do php /path/to/your/script.php & sleep 0.5s; done The '&' will fork the process in the background, so the timing should be somehow accurate. I guess after some time it will become out of sync with a real clock, so you might either want to add timestamps to whatever your ...


2

In Ubuntu, by default, the cron daemon runs all the jobs using sh (dash) shell and dash does not have source builtin. You need to use the POSIX way i.e. .: * * * * * . activate myenv3 && cd ~/foo/bar && python sssb.py Alternately, you can run the job as an argument to bash: * * * * * "$(command -v bash)" -c 'source activate myenv3 ...


0

As mentioned in other answers, expect can solve this problem. I ended up with something like this, save as reprepro.exp and make it executable with chmod 755 reprepro.exp #!/usr/bin/expect -f set timeout 5 set passphrase "$env(SIGNING_PASSWORD)" # Call reprepro with variable length arguments, so that this script # takes the same arguments as the original ...



Top 50 recent answers are included