How to Set up a Crontab File on Linux
Method 1 of 2:
Setting up the File
- Using your favourite editor, create a cron file with a line for each job you wish to schedule, in the format: m h d m w command
- m minute
- h hour
- d day of month
- m month 1-12
- w weekday 0-7, Sun,Mon, etc (Sunday = 0 = 7) It is easy to remember if you think of the way one would say a date: Wednesday, July 29, at 10:30, then reverse the order.
- Load your file into crontab: crontab yourfile
Method 2 of 2:
Trying an Example
- Create a file testCron.txt containing the following lines:
- # do this every 10 minutes
- */10 * * * * date >> ~/testCron.log
- Load it into cron: crontab testCron.txt
- Wait 30 minutes, check testCron.log, if it works it will update your file with a time stamp 3 times.
- Remove the crontab so that it does not run forever: crontab -r
5 ★ | 1 Vote
You should read it
- How to open and read the .DAT file?
- What is DMG file?
- What is an XML file and how to open it?
- What is a DLL file, and how does this file work?
- What is a .tmp file? How to open .tmp file on Windows computer?
- What are UDF files?
- How to run scripts on boot on the Raspberry Pi
- What file is AAC? How to open, edit and convert AAC files
May be interested
- How to modify and manage Hosts files on Linuxif you need to block web pages or create personalized web shortcuts on linux, solve these tasks by adding or adjusting a few lines in the hosts file.
- 5 best applications to convert audio and video files on Linuxlinux users are spoiled for choice when it comes to open source audio and video converters. here are the best media converters available today for linux, including a range of different file formats.
- What are CBR and CBZ files? How to read CBR and CBZ files in Linuxmaybe while playing online, you've seen some cbr and cbz files. these are the two most popular formats for distributing comics and graphic novels online.
- How to Create an ISO File in Linuxthis wikihow teaches you how to turn a group of files into an iso file on a linux computer. you'll use the linux command line to do this. gather your iso files in the home directory. place any files that you want to turn into an iso file...
- How to use wildcards to match file names in Linuxsearching for files in linux can seem confusing at first, but don't worry, it gets easier once you understand wildcards. wildcards are special symbols that help you select multiple files or folders without having to type each name individually.
- Micro editor in Unix / Linuxthere are many ways to edit files in unix and for me, one of the best ways is to use the editor to edit the micro screen orientation. this editor lets you edit the lines of content with other lines in the file.
- Use Journalctl to read the system log on Linuxmost linux-based operating systems have switched to systemd, which comes with a different daemon log called journald. to interact with these logs, use the journalctl utility.
- How to Delete Read-Only Files on Linuxthere are several ways to help you delete files read-only on linux. if it's a file you own, you can change the file permissions or use the sudo command to delete the original file. however, if you cannot delete files with write permissions (or see a 'read only file system' error message), you need to change the drive with the appropriate permissions. this article will show you how to delete read-only files on any linux distribution, including ubuntu and linux mint.
- The Cat command in Linuxthe cat command (short for 'concatenate') is one of the most frequently used commands in operating systems like linux / unix. the cat command allows users to create one or more files, view file contents, join files, and redirect output in a terminal or file.
- File Management in Unix / Linuxall data in unix is organized in files. all files are organized in folders. these directories are organized in a tree structure that is called the file system.