Hot answers tagged scheduling
As others have pointed out, cron will email you the output of any program it runs (if there is any output). So, if you don't get any output, there are basically three possibilities: crond could not even start a shell for running the program or sending email crond had troubles mailing the output, or the mail was lost. the program did not produce any output ...
You can do this directly from the shutdown command, see man shutdown: SYNOPSIS /sbin/shutdown [-akrhPHfFnc] [-t sec] time [warning message] [...] time When to shutdown. So, for example: shutdown -g 21:45 That will run shutdown -h at 21:45. For commands that don't offer this functionality, you can try one of: A. Using at The at daemon ...
Depending on how your linux system is set up, you can look in: /var/spool/cron/* (user crontabs) /etc/crontab (system-wide crontab) also, many distros have: /etc/cron.d/* These configurations have the same syntax as /etc/crontab /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly, /etc/cron.monthly These are simply directories that contain ...
I use a simple script with at: #!/bin/bash # email reminder notes using at(1)... read -p "Time of message? [HH:MM] " time read -p "Date of message? [dd.mm.yy] " date read -p "Message body? " message at "$time" "$date" <<EOF echo "$message" | mailx -s "REMINDER" email@example.com EOF You could just as easily pipe the $message to notify-send or dzen if ...
Probably depends on the crond you are using. For example, with Vixie-Cron (debian/ubuntu default) you get it for the current user via: $ crontab -l or for another user via $ crontab -l -u juser To get the crontabs for all users you can loop over all users and call this command. Alternatively, you can look up the spool files. Usually, they are are ...
On Ubuntu/Debian/Centos you can set up a cron job to run @reboot. This runs once at system startup. Use crontab -e to edit the crontab and add a line like the example below e.g. @reboot /path/to/some/script There are lots of resources for cron if you look for them. This site has several good examples.
In the case of your particular script, neither Myscript nor command D will ever be executed. You've defined a function C, but you aren't calling it. The order of execution is: command B runs to completion. command E runs to completion. If you were to call C, it would run Myscript to completion, then run command D to completion. Everything you invoke in ...
Yes, that would work. If unsure, you may test it with sleep 15 Ctrl+z fg; echo "it works"
That's the way GNU/Linux and other multitasking systems work, they share the processor among the running processes, dot won't have 99%, but 100% during 99% of the time. Each process dominates the processor for a certain period of time. This is handled by schedulers (linux has several schedulers, some just employ the usual strategy, some try to give more ...
I think the at command is what you are after. E.g.: echo "mail -s Test mstumm < /etc/group" | at 16:30 This will e-mail you a copy of /etc/group at 4:30 PM. You can read more about at here: http://www.softpanorama.org/Utilities/at.shtml
ionice [-p] <pids/> For example: $ ionice -p `pidof X` none: prio 0 This means X is using the none scheduling class (best effort) with priority 0 (highest priority out of 7). Read more with man ionice.
Cron is used to schedule a job to run repeatedly. What you want is at, which schedules a job to run one-time. For your example you can write: at midnight This will bring up an interactive prompt where you can enter /tmp/script.sh followed by Ctrl+D.
You can suspend or hibernate your system and then automatically wake it up with rtcwake command. For example to suspend (to ram) and resume in 60 seconds do rtcwake -s 60 -m mem To hibernate (suspend to disk) in one hour from now and resume in two hours: sleep 3600; rtcwake -s 3600 -m disk You can also wakeup the system at given time with -t option ...
The traditional unix command at is usually used for this purpose. e.g. echo 'sudo port install gcc45' | at midnight
NVRAM WakeUp claims to do it; I've never tried. It may not work on all BIOSes, and if it fails a likely consequence is to overwrite a different critical setting that could make your computer unbootable, so use with caution. If you only suspend the computer, APM tools can set a wake-up time with apmsleep. I've successfully used my laptop as an alarm clock ...
The proportion of the processor time a particular process receives is determined by the relative difference in niceness between it and other runnable processes. The Linux Completely Fair Scheduler (CFS) calculates a weight based on the niceness. The weight is roughly equivalent to 1024 / (1.25 ^ nice_value). As the nice value decreases the weight increases ...
You should be able to do this with a mains timer between the mains outlet and the power supply. Shut down the Raspberry at 4 A.M using a cron job, then set the timer to cut the mains a bit later and to restore power at 5 A.M.
If you aren't seeing the mails, or if you are spamming root@yourcompany with the errors which can be quite annoying to the people who use that account for monitoring. Try sending the output to Syslog instead: */5 * * * * yourcronjob 2>&1 | /usr/bin/logger -t yourtag Then, wait for the cronjob to run and look for the error in /var/log/messages (or ...
You could use the command 'at' at now +4 hours -f commandfile Or at now +$((($RANDOM % 10)+2)) hours -f commandfile
Another typical way to start something at boot on many *nix platforms is (or was, I think this may be starting to loose favor -- see alternatives) to put scripts in a directory which, depending on the particular OS/distribution, might be something like /etc/rc2.d, /etc/rc3.d, /etc/rc/rc3.d, or the like (different distributions use different "run levels", ...
Fcron has a lot of additional features over common cronds. For example: set the max system load average value under which the job should be run (quote from the Homepage) Thus, you could use fcron to setup what you want.
You can always explicitly send the job output to a log file: 0 8 * * * /usr/local/bin/myjob > /var/log/myjob.log 2>&1 Keep in mind that this will supercede the mail behaviour that has been mentioned before, because crond iself won't receive any output from the job. If you want to keep that behaviour you should look into tee(1).
In echo 'one' > /tmp/a The shell does an open(O_WRONLY) on the pipe and then spawns echo which then does the write("one\n"). The open will block until some other process opens the pipe in RD_ONLY or RD_WR though. And so will the open from your echo two. So at the moment you do more /tmp/a you've got two processes ready to fire that have not opened ...
qBittorrent does have scheduling! However, it may or may not be sufficiently sophisticated for your needs. Scheduling Global Changes in Limits for Specific Days/Times Click Tools > Options.... Click the Speed tab on the left. At the bottom of the window you'll see options to set the upload and download rate limits for Alternative Global Rate Limits. Then ...
This is 100% normal with respect to threading on any and all operating systems. The documentation for your thread library, any examples and tutorials you may find, etc. are likely to make a point of this as it is often confusing to people when they are learning the ropes of threading. Threads are by default (and by definition) not synchronized. This means ...
Yep, your processor does a NOP (No Op) or HLT Linux uses an idle process. This task does nothing but sends HLT and makes the CPU use less power and heat while there is nothing to do. Then when there is work to be done the CPU "comes back on" and does work. Now, keep in mind that the Linux scheduler will do "any work it can" before that point. This HLTing ...
In newer kernels, the Completely Fair Scheduler is used (it replaces the O(1) scheduler of older kernels). The CFS stores the planned task in a red-black tree and uses the spent CPU time amount for the process has run as a key. This allows the scheduler to pick the process with the least amount of run-time (which is stored in the left-mode node of the tree) ...
The default cron configuration will send you a mail with the output of your program. If this fails, you could try wrapping your failing program in a shell script that ensures that the program does not fail, and you could further log the output. This is a configurable setting on some cron implementations.
The generic way to use at is Write a script that does what you want to do. Use the full path for all external commands, log output to a proper log-file or mail it. Test the script. Activate it with at -f YOURSCRIPT -t MMDDhhmm
Put the logic code for testing your condition in the script itself, don't try and put it in (or associate it with) cron - complex logic is not what cron was designed for. So, in your script you test the condition and, if it evaluates to true, your processing code runs. If it evaluates to false, exit the script cleanly. Assuming that your 'conditions' ...
Only top voted, non community-wiki answers of a minimum length are eligible