To write timed tasks to access Web pages and open pictures
The original wording is
#!/bin/Bash
#可以执行 Echo
echo "Hello" > Dir/file.txt
#不可以执行 Xdg-open
xdg-open https:// /usr/bin/xdg-open/home/cui/picture/used/kitty Zhang. jpg;
The above notation cannot be performed properly, adding
Export display=:0
Can execute Xdg-open
The reason Xdg-open command used to open the Web page and the picture needs to be set for him to display the environment variables.
The display environment variable is automatically set to:0:0, the terminal can be opened, the output graphics program name (such as Xclock) to start the program, the graphics will be displayed on the local window,
Export display=:0
Xdg-open https://
/usr/bin/xdg-open/home/cui/picture/used/kitty Zhang. jpg;
[Email protected]:~$ crontab-new crontab[email protected]:~$ crontab-e
Usage: crontab [-u user] file -u user] [-i] {-e |-L |-R} (default is 1003.2 ) -E (Edit user's crontab ) -L (list user' S crontab) -R (delete user's crontab)-I (prompt before deleting User's crontab)
Specific rules/syntax:
What the crontab file means:
In the crontab file created by the user, each line represents a task, each field of each row represents a setting, its format is divided into six fields, the first five is the time setting segment, and the sixth paragraph is the command segment to execute, in the following format:
Minute hour day Month Week command
which
Minute: Represents minutes, which can be any integer from 0 to 59.
Hour: Represents the hour, which can be any integer from 0 to 23.
Day: Represents a date, which can be any integer from 1 to 31.
Month: Represents the month, which can be any integer from 1 to 12.
Week: Represents the day of the week, which can be any integer from 0 to 7, where 0 or 7 represents Sunday.
Command: The commands to execute can be either system commands or script files that you write yourself.
In each of these fields, you can also use the following special characters:
Asterisk (*): represents all possible values, such as the month field if it is an asterisk, the command action is executed monthly after the constraints of other fields are met.
Comma (,): You can specify a list range with a comma-separated value, for example, "1,2,5,7,8,9"
Middle Bar (-): An integer range can be represented by a middle bar between integers, such as "2-6" for "2,3,4,5,6"
Forward slash (/): You can specify the interval frequency of the time with a forward slash, such as "0-23/2", which is performed every two hours. A forward slash can be used with asterisks, such as */10, if used in the minute field, which means that it executes every 10 minutes.
5. Use instance Instance 1: Executes command commands every 1 minutes:* * * * *Command Instance 2: the 3rd and 15 minutes of the hour are executed:3, the* * * *Command Instance 3: Execute commands at 3rd and 15 minutes from 8 o'clock in the morning to 11:3, the 8- One* * *Command Example 4: Every two days from 8 o'clock in the morning to 11 points in the 3rd and 15 minutes of the execution of the commands:3, the 8- One*/2* *Command Instance 5: Every Monday from 8 o'clock in the morning to 11 in the 3rd and 15 minutes execution of commands:3, the 8- One* *1Command instance 6:21:30 restart SMB command per night: - +* * * */etc/init.d/SMB Restart Instance 7:1 per month,Ten, the 4:45 restart SMB command on 22nd: $ 4 1,Ten, A* */etc/init.d/SMB Restart Instance 8:1:10 restart SMB command per Saturday, Sunday:Ten 1* *6,0/etc/init.d/SMB Restart Instance 9: The SMB command restarts every 30 minutes from 18:00 to 23:00 every day:0, - -- at* * * */etc/init.d/SMB Restart Instance 10: Every Saturday night:xxpm Restart SMB command:0 at* *6/etc/init.d/SMB Restart Instance 11: Restart SMB command every hour:* */1* * * */etc/init.d/SMB Restart Instance 12: From 11 o'clock to 7 in the morning, restart the SMB command every hour:* at-7/1* * * */etc/init.d/SMB Restart Instance 13:4th per month with 11-point restart SMB command from Monday to Wednesday:0 One 4* mon-wed/etc/init.d/SMB Restart Instance 14: January 1 4-point restart SMB command:0 4 1Jan */etc/init.d/SMB Restart Instance 15: Hourly Execution/etc/script commands in the Cron.hourly directory: on* * * * Root run-parts/etc/cron.hourly Description: Run-parts This parameter, if you remove this parameter, you can write a script name to run, not the directory name.
Turn http://www.cnblogs.com/peida/archive/2013/01/08/2850483.html
Linux timed Execution Task crontab