135

You can use the at command. The at execute commands at a later time. The at utility shall read commands from standard input and group them together as an at-job, to be executed at a later time. Usually, at is installed by default in Ubuntu, but if your release doesn't include it, install via: sudo apt-get install at For more information, options, ...


25

Put it in your crontab. Open your cron table by: crontab -e Now add: */5 * * * * /path/to/script.sh Don't forget to make the script executable beforehand. As your script depends on X, probably will be a good idea to add the DISPLAY to the script's environment: */5 * * * * DISPLAY=:0 /path/to/script.sh Replace :0 with your actual DISPLAY (can be found ...


20

The Speed Limit in Transmission throttles the upload/download speeds during the time set. What you want to do is set the upload/download speed values to 0 and implement that starting at 0800 and end at 0200. That should deactivate all uploads/downloads starting at 8am until 2am the following day.


16

You can 'force run' an anacron job by ignoring its timestamps; anacron -f Other options like -n can also be used if you wish. From man anacron: -f Force execution of the jobs, ignoring the timestamps. -s Serialize execution of jobs. Anacron will not start a new job before the previous one finished. -n Run jobs now. ...


14

The lazy option If you want the easy way, and avoid having to find out which environment variable to set: Make sure your script includes the shebang Make it executable Add the following to Startup Applications: /bin/bash -c "sleep 15 && while true; do <path_to_your_script.sh> ; sleep 300; done" Dash > Startup Applications > Add. Add the ...


14

gnome-schedule is indeed not in the official Ubuntu repositories for Ubuntu 16.04. However, at https://bugs.launchpad.net/ubuntu/+source/gnome-schedule/+bug/1576060/comments/23, Kartik (kartik-arora95) has kindly compiled a .deb package for version 2.3.0 of Gnome Schedule that is reportedly working for Ubuntu 16.04. Download the .deb package provided at the ...


13

Use the Gnome-based GUI for cron, at, and the like: The introduction of the CronHowto suggests using the gnome-schedule gui, which is much nicer than typing all the garbage into the terminal (esp. for "average" Ubuntu users who are not "power" *nix/bsd users.) Run it by using the Unity Dash (or other applications menu) to look for Scheduled Tasks or ...


13

Edit the crontab entries using crontab -e command (by default this will edit the current logged-in users crontab) and add the following line: 0 3 * * * echo $PASSWD | sudo -S reboot #change $PASSWD with your password Save the file and check the new crontab entry with crontab -l. If you want to use only: 0 3 * * * sudo reboot as crontab, this doesn't ...


11

Yes, you can set a cron job. For example if now the time is 14:39:00 and today is friday, 30 august, you can add the following cron job (to be executed after 8 hours) in your crontab file using crontab -e command: 39 22 30 8 5 /path/to/mycommand.sh More about: https://help.ubuntu.com/community/CronHowto http://en.wikipedia.org/wiki/Cron


10

Open a terminal (Ctrl+Alt+T) then run: crontab -e If it asks you to select an editor, choose nano. Insert these lines at the end of the file: 0 3 * * * vboxmanage controlvm virtualpbx acpipowerbutton 5 3 * * * vboxmanage startvm virtualpbx -type headless Press Ctrl+O,Return to save the file and Ctrl+X to exit. Then run exit to close the terminal. EDIT ...


10

You can use gsettings to access the responsible setting in the dconf registry easily from the command line. The setting whether to show hidden files (with names starting with .) is located in the schema org.gtk.Settings.FileChooser and called show-hidden. Allowed values are either true (show hidden files) or false (don't show them). So here are the ...


9

Check the output of date in a loop. This is a quick and dirty way to do this, like if you can't use at, cron, or other tools. Say you want your script to run at noon: until [[ $(date +%H:%M) == 12:00 ]]; do sleep 30 done ./mycommand.sh Say you want it to run tomorrow at noon (today is Nov 24 for me): until [[ $(date +%d_%H:%M) == "25_12:00" ]];...


9

Cron versus background script Of course the very first thing that pops into the mind is to use cron. Whether you use cron, or a small background script is mainly a matter of taste. The advantage of cron is that it hooks up on an existing process (although a script adds, well, actually nothing to the processor load). The advantage of a background script ...


9

TL;DR: Move sudo across the pipe (|) to the at command itself. You haven't really been running at as root. You ran cat as root (sudo cat ...), and piped the output of cat to at, but you did not run the at command itself as root. On many systems, some non-root users are permitted to run at jobs. However, if that's not what you want, your system is ...


8

Use a cronjob to auto sleep and auto resume. The command below will put the the computer to sleep at 02.00 AM and start the machine 4 hours later (14400 seconds) 00 2 * * * root /usr/sbin/rtcwake -m off -s 14400


8

Yes, it's possible to install an SMTP send connector on your Microsoft Exchange server and then it's just a question of: configuring sendmail adding the following line to your cron script: mutt -s "query report" -a /home/me/pdfs/query.pdf me-group@HiThere.com < /home/me/mail/query-report-body.txt where: -s subject is the subject of the message. (query ...


8

It's a better idea to use "unattended-upgrades" instead. Its purpose is to keep the computer current with the latest security (and other) updates automatically. [1] To install: sudo apt install unattended-upgrades Read more about how to get it work: here. To address your question, you can edit /etc/crontab file and run your commands using root user ...


6

I was going to use the above scheduled throttling, but thought of something additional and that is to just use the cron daemon via a start and stop: (e.g. Add the following to cron jobs via crontab -e) * 2 * * * sudo service transmission-daemon start * 8 * * * sudo service transmission-daemon stop for you 2am-8am schedule. Perhaps even start it a ...


6

Try instead: ~$ at now + 1 minute at> ls -ahl > /tmp/at_test at> ^D You will find /tmp/at_test after command executed. If you want to run some GUI app you should specify DISPLAY variable; Use echo $DISPLAY to find out you display ~$ at now + 1 minute at> DISPLAY=:0 gedit at> ^D Piping is also ok: echo "DISPLAY=:0 gedit" | at now + 1 ...


6

To write a script to send messages over telegram-cli, you need to do the following: Move to the directory where telegram-cli is: Open telegram-cli with your key Load your contact list with -W Send the message to anyone on your contact list previously loaded To achieve that: cd /path/to/tg && bin/telegram-cli -W server.pub -e "msg contact message" ...


5

As of 0.6.23, duplicity will do file locking on the cache directory associated with the backup. It is possible to have two duplicity instances running as long as they are different backups. Duplicity will not allow overlap of the same backup. The previous versions would not detect the problem and that would potentially cause problems when trying to ...


5

Edit your cron with crontab -e and add this line into your crontab to run it as schedule job for every 3 hours 00 */3 * * * * ~/killtelegram.sh >/dev/null 2>&1 2.Open your terminal and type below command touch ~/killtelegram.sh chmod +x ~/killtelegram.sh open killtelegram.sh with your favorate editor and write as below #!/bin/bash telegram &...


5

I will have to check for other releases, but on 14.04 and 15.10, the gsettings command to check visibility of hidden files is: gsettings get org.gtk.Settings.FileChooser show-hidden To set the value to false (don't show hidden files): gsettings set org.gtk.Settings.FileChooser show-hidden false or true: gsettings set org.gtk.Settings.FileChooser show-...


5

Keep in mind that scripts installed in /etc/cron.{hourly|daily|weekly|monthly} must be executable, for run-parts to process them. Update: Indeed, defining the shebang is also mandatory in cron scripts for run-parts to process them. And as a general rule: you should always set one.


5

Unattended-Upgrades is run by the script apt-compat (Ubuntu 14.04 or older: apt) in /etc/cron.daily. So you could probably just edit your /etc/crontab to run cron.daily at a different time of the day or move it to a custom cronjob. The script contains functions to sleep a short "random" amount of time (0-30mins) before executing /usr/lib/apt/apt.systemd....


5

Don't use cron but at: echo 'mycommand' | at 16:00 or at 16:00 -f some_script.sh See this


4

Drop to console Create a bash script, one for each of the commands, (don't forget to make them executable with sudo chmod +x filename.sh) and store them in a place that cron can run them from. sudo anacron -t 00 03 * * * /path/to/script/script1.sh sudo anacron -t 10 03 * * * /path/to/script/script2.sh Enjoy!


4

Queue You can make a list of URLs to download in a plain text file, then use wget -i list-of-urls-file.txt to fetch them. Scheduling As for scheduling, wget does not have a scheduler. Use cron instead. You can learn more about cron with the commands man 1 crontab and man 5 crontab. Here's an example session where I setup a cron job that runs wget ...


4

Open crontab (crontab -e)and add this entry. 0 16 24-31 * 4 script_file You can use this online cron generator. Hope this helps.


4

Run the script below in the background, and it will lock the screen after an arbitrary number of minutes: The script #!/usr/bin/env python3 import subprocess import time import sys t = 0; max_t = int(sys.argv[1]) while True: # check runs once per minute time.sleep(60) # check the lock status, add 1 to current time if not locked, else t = 0 ...


Only top voted, non community-wiki answers of a minimum length are eligible