HomeSoftwareScriptsNotesToolboxGallery
Computing
Thoughts on Coding Styleddrescue Recovery NotesDomain 301 Perma RedirectWin/Linux PuTTY File TransferOpenVPN Site-to-Site SetupParity Data CheckingRclone Quick ReferenceSnapRAID NotesSSH TunnelingTransfer E-Mails with IMAPUDK Third Person CameraVPN Protocol Ports

GNU/Linux
Apache Process Mem UsageApache and CA OpenSSLApache2 htpasswd NotesCentOS 7 GlusterFS NotesCracking WEP and WPADebian 7 on Hyper-VDebian 7 to 8 UpgradeDebian 8 to 9 UpgradeDebian 9 DRBD SetupDebian and VirtualboxDebian and LSBInitScriptsDebian and systemdDebian Apache LetsEncryptDebian Apt AutoremoveDebian Cron & AnacronDebian KVM HypervisorLinux Bash ColorsLinux Cron BackupLinux Dnsmasq Setup NotesIptables Chain ExampleIptables Firewall and GatewayLinux MD RAID BasicsLinux iproute2 RoutingLinux SFTP Network ShareAvoid Linux Shell LoggingChecking Storage UsageLinux I/O Disk PerformanceLinux ZFS NotesVi/Vim Basic Reference

Microsoft
Bypass Windows PasswordDaz and ToolkitMRTG Network Traffic ViewMS Outlook NotesDOS File Content SearchDOS Merging VCF filesROBOCOPY Batch ScriptingPowerShell Reference NotesThe runas CommandTeamViewer on HeadlessUpdateOrchestrator ModWorkgroup Failover ClusterDisable OneDrive in W10Windows 10 ServerWindows WiFi and netshWindows Boot Custom UIHyper-V NetworkingHyper-V ReplicationIIS10 and PHP7 SetupLet's Encrypt and IISPlex Media Server MigrationRebuilding Boot PartitionSecuring RDP ConnectionsServer 2012 R2 SetupWindows Shortcut CommandsWBAdmin Bare-Metal Backup

BSD/Unix
FreeBSD 10.0 Setup (NOR)

C#/.NET
C# Associative ArraysC# Asynchronized WebcallC# Base64 GZipped JSONC# Broadcast Registry ChangesChanging a project nameC# Code Execution TimerCode Signing With SigntoolC# Creating a WebserverC# Dealing with WhitespacesC# djDBI for SQL CEC# Form ReferencingC# Get Folder SizeC# Handling DisconnectsC# HTTP POST and GETC# Importing DLL FunctionsC# Installing ServicesC# Kill and Start ProcessesC# Lambda ExpressionsC# Local AppData HandlingC# Memory StreamReadingC# Minimize to System TrayC# PDFsharp and MigraDocC# Public Fields vs PropsC# Registry HandlingC# Regular ExpressionsC# Require AdministratorC# RichTextBox File StreamC# Application SettingsC# SqlCeConnection CodeC# Start with hidden formC# String EncryptionC# Cross Thread HandlingC# Updating A RuntimeC# Gmail as SMTPVSI Dependency ErrorC# Handle XML

C/C++
AOB Scan/InjectC Autodelete Old FilesC/C++ Multiline StringsC Socket ListeningC StringsGDI Double BufferWin32 Button ControlWin32 Edit ControlWin32 GetLastError()Win32 KeyloggingWin32 KeypostingWin32 Simple WindowWin32 Socket ProgrammingWin32 VERSIONINFO

PHP
Bitwise IP HandlingPHP ClassesContent Length HandlingDetecting Mobile BrowsersGoogle Captcha IntegrationHidden DownloadsHostname and Port RegexJSON Output HeadersMS Access Conn with COMProportional Image SizingRandom StringsRecursive FunctionsSending MailPHP SessionsSimple HTML-2-PDFPHP SimpleXMLTernary Operator and If/Else

SQL
MS Access Connection StringsMSSQL Case SensitivityMySQL Root Password ResetMySQL Check Slow QueriesColumn CountingQuick Note on CROSS JOINQuick Note on INNER JOINRandom Rows

HTML
HTML Raw Skeleton

JavaScript
AJAX Basicsevent.keyCode ReferenceIE7 Onclick EventsIE GIF Animation Problem

Java
Java Notater (NOR)

CSS
Border StylesFlyout MenusFont-Family Reference

Electrical
Betegnelser og SpenningsfallLovdata Elektrisk ArbeidResistors Series and ParallelSilicone and Circuit Boards

Debian Cron & Anacron


Cron, as supplied in Debian, has two purposes
- To run system jobs on a daily/weekly/monthly basis
- To allow users to setup their own schedules

The system schedules are setup when the package is installed, via the creation of some special directories: /etc/cron.d
/etc/cron.daily
/etc/cron.hourly
/etc/cron.monthly
/etc/cron.weekly

Except for the first one which is special (manpage: In general, the system administrator should not use /etc/cron.d/, but use the standard system crontab /etc/crontab), these directories allow scheduling of system-wide jobs in a coarse manner. Any script which is executable and placed inside them will run at the frequency which its name suggests. By default you can see in /etc/crontab that it checks if anacron exists before running the intermittent jobs daily, weekly, monthly. If you need exact timing on a continous system you should use cron as anacron is for non-continuous systems and doesn't really care about the exact time the jobs run, as long as they run within the intermittent period (day, month, weekly). Hourly seems to still be controlled by cron. I advise using cron for continuous systems and exact timing.

/etc/crontab and the files in /etc/cron.d must be owned by root, and must not be group- or other-writable. The files under /etc/cron.d or the files under /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly and /etc/cron.monthly may also be symlinks, provided that both the symlink and the file it points to are owned by root. Cron wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute. When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists).

If you wish to stop output from being e-mailed to you, just redirect it:
0   *   *   *   *  /bin/ls  > /dev/null 2&>1

The normal manner which people use cron is via the crontab command. This allows you to view or edit your crontab file, which is a per-user file containing entries describing commands to execute and the time(s) to execute them. To display your file you run the following command:
$ crontab -l 
	^ (edit with -e)

Root can view any users crontab file by adding "-u username", for example:
# crontab -u username -l

The format of these files is fairly simple to understand. Each line is a collection of six fields separated by spaces.

The fields are:
 1. The number of minutes after the hour (0 to 59)
 2. The hour in military time (24 hour) format (0 to 23)
 3. The day of the month (1 to 31)
 4. The month (1 to 12)
 5. The day of the week(0 or 7 is Sun, or use name)
 6. The command to run

More graphically they would look like this:

*     *     *     *     *  Command to be executed
-     -     -     -     -
|     |     |     |     |
|     |     |     |     +----- Day of week (0-7)
|     |     |     +------- Month (1 - 12)
|     |     +--------- Day of month (1 - 31)
|     +----------- Hour (0 - 23)
+------------- Min (0 - 59)

Examples
# Run the `something` command every hour on the hour
0   *   *   *   * /sbin/something

# Run the `nightly` command at ten minutes past midnight every day
10  0   *   *   * /bin/nightly

# Run the `monday` command every monday at 2 AM
0   2   *   *   1  /usr/local/bin/monday

One last tip: If you want to run something very regularly you can use an 
alternate syntax: Instead of using only single numbers you can use ranges or 
sets. A range of numbers indicates that every item in that range will be 
matched, if you use the following line you'll run a command at 1AM, 2AM, 3AM, 
and 4AM:

# Use a range of hours matching 1, 2, 3 and 4AM
*   1-4   *   *   * /bin/some-hourly

A set is similar, consisting of a collection of numbers seperated by commas, 
each item in the list will be matched. The previous example would look like 
this using sets:

# Use a set of hours matching 1, 2, 3 and 4AM
*   1,2,3,4   *   *   * /bin/some-hourly