How to control cron in Ubuntu 16.04 LTS?
up vote
5
down vote
favorite
The old gnome-schedule
program (which works fine under Raspbian Jessie) has been deprecated in Ubuntu, beginning with Ubuntu 14.04 LTS.
So how do we control cron jobs in Ubuntu 16.04?
16.04 cron
add a comment |
up vote
5
down vote
favorite
The old gnome-schedule
program (which works fine under Raspbian Jessie) has been deprecated in Ubuntu, beginning with Ubuntu 14.04 LTS.
So how do we control cron jobs in Ubuntu 16.04?
16.04 cron
2
github.com/alseambusher/crontab-ui might be an option for you
– Rinzwind
Aug 2 '17 at 20:11
OK, I got nodejs 8 installed, then used npm to install crontab-ui. But now when I type crontab-ui I get the error: /usr/bin/env: ‘node’: No such file or directory - so I see why you said it "might" be an option
– SDsolar
Aug 3 '17 at 2:08
The good news is that it all uninstalled cleanly. Thanks for the tip; too bad it didn't work out.
– SDsolar
Aug 3 '17 at 6:22
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
The old gnome-schedule
program (which works fine under Raspbian Jessie) has been deprecated in Ubuntu, beginning with Ubuntu 14.04 LTS.
So how do we control cron jobs in Ubuntu 16.04?
16.04 cron
The old gnome-schedule
program (which works fine under Raspbian Jessie) has been deprecated in Ubuntu, beginning with Ubuntu 14.04 LTS.
So how do we control cron jobs in Ubuntu 16.04?
16.04 cron
16.04 cron
edited Aug 2 '17 at 20:54
user692175
asked Aug 2 '17 at 20:09
SDsolar
1,45941337
1,45941337
2
github.com/alseambusher/crontab-ui might be an option for you
– Rinzwind
Aug 2 '17 at 20:11
OK, I got nodejs 8 installed, then used npm to install crontab-ui. But now when I type crontab-ui I get the error: /usr/bin/env: ‘node’: No such file or directory - so I see why you said it "might" be an option
– SDsolar
Aug 3 '17 at 2:08
The good news is that it all uninstalled cleanly. Thanks for the tip; too bad it didn't work out.
– SDsolar
Aug 3 '17 at 6:22
add a comment |
2
github.com/alseambusher/crontab-ui might be an option for you
– Rinzwind
Aug 2 '17 at 20:11
OK, I got nodejs 8 installed, then used npm to install crontab-ui. But now when I type crontab-ui I get the error: /usr/bin/env: ‘node’: No such file or directory - so I see why you said it "might" be an option
– SDsolar
Aug 3 '17 at 2:08
The good news is that it all uninstalled cleanly. Thanks for the tip; too bad it didn't work out.
– SDsolar
Aug 3 '17 at 6:22
2
2
github.com/alseambusher/crontab-ui might be an option for you
– Rinzwind
Aug 2 '17 at 20:11
github.com/alseambusher/crontab-ui might be an option for you
– Rinzwind
Aug 2 '17 at 20:11
OK, I got nodejs 8 installed, then used npm to install crontab-ui. But now when I type crontab-ui I get the error: /usr/bin/env: ‘node’: No such file or directory - so I see why you said it "might" be an option
– SDsolar
Aug 3 '17 at 2:08
OK, I got nodejs 8 installed, then used npm to install crontab-ui. But now when I type crontab-ui I get the error: /usr/bin/env: ‘node’: No such file or directory - so I see why you said it "might" be an option
– SDsolar
Aug 3 '17 at 2:08
The good news is that it all uninstalled cleanly. Thanks for the tip; too bad it didn't work out.
– SDsolar
Aug 3 '17 at 6:22
The good news is that it all uninstalled cleanly. Thanks for the tip; too bad it didn't work out.
– SDsolar
Aug 3 '17 at 6:22
add a comment |
3 Answers
3
active
oldest
votes
up vote
7
down vote
accepted
Since there is as of yet no GUI-based cron
controller available for Ubuntu 16.04, we must go back to the old-school methods which always work - do it from the command line:
Official Ubuntu documentation: CronHowto
Selected excerpts:
For guidance, you can always use
man crontab
To edit your cron programs use this command:
crontab -e
From the man page:
Crontab Lines
Each line has five time-and-date fields, followed by a command, followed by a newline character ('n'). The fields are separated by spaces. The five time-and-date fields cannot contain spaces. The five time-and-date fields are as follows: minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday).
01 04 1 1 1 /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on January 1st plus every Monday in January.
An asterisk (*) can be used so that every instance (every hour, every weekday, every month, etc.) of a time period is used.
01 04 * * * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on every day of every month.
Comma-separated values can be used to run more than one instance of a particular command within a time period. Dash-separated values can be used to run a command continuously.
01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 01 and 31 past the hours of 4:00am and 5:00am on the 1st through the 15th of every January and June.
The "/usr/bin/somedirectory/somecommand" text in the above examples indicates the task which will be run at the specified times. It is recommended that you use the full path to the desired commands as shown in the above examples. Enter which somecommand in the terminal to find the full path to somecommand. The crontab will begin running as soon as it is properly edited and saved.
You may want to run a script some number of times per time unit. For example if you want to run it every 10 minutes use the following crontab entry (runs on minutes divisible by 10: 0, 10, 20, 30, etc.)
*/10 * * * * /usr/bin/somedirectory/somecommand
which is also equivalent to the more cumbersome
0,10,20,30,40,50 * * * * /usr/bin/somedirectory/somecommand
Cron also offers some special strings, which can be used in place of the five time-and-date fields:
@reboot
- Run once, at startup.
@yearly
- Run once a year,"0 0 1 1 *"
.
@annually
- (same as@yearly
)
@monthly
- Run once a month,"0 0 1 * *"
.
@weekly
- Run once a week,"0 0 * * 0"
.
@daily
- Run once a day,"0 0 * * *"
.
@midnight
- (same as@daily
)
@hourly
- Run once an hour,"0 * * * *"
.
Note that all cron
jobs begin in the user's $HOME
directory, so it is advisable to use fully-qualified pathnames both in the cron
program and in your scripts.
btw, you can always usecrontab -l
to list your cron jobs.
– SDsolar
Aug 3 '17 at 21:50
add a comment |
up vote
0
down vote
You can't influence the crontab, but there is the Orage Time/Calendar application, usually acitvated in the main menu.
There you can schedule tasks as well.
Double click on the clock, to open the calendar, then double click on a single day.
Select a event, new. Give it a name, here, for example, 'Coffeetime'. Set the time to 11:00.
Now choose tab: Reminder, Application, use: YOUR_PROGRAM_TO_SCHEDULE_HERE Deactivate sound and other unsound options.
Now choose tab: Repetition, Frequency:
- daily, weekly, monthly, yearly
- 1 for every (day, for example), 2 for every other day and so on
- more options are available (interval to pause, i.e.)
I have a German UI, so maybe my translation for the tabs doesn't fit exactly.
add a comment |
up vote
-1
down vote
If it matters to anybody then in the Terminal, type nano /etc/crontab
The default crontab will contain the following lines:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
Move the cursor to the end of the line and write our cron job like below which will run after every 10 minutes
*/10 * * * * root /usr/bin/curl https://www.google.com
If you want to use session, then you need to store and retrieve cookies data to and from a file like,
*/10 * * * * root /usr/bin/curl -c /tmp/cron-session-cookies.txt -b /tmp/cron-session-cookies.txt --silent https://www.google.com >/dev/null 2>&1
New contributor
Don't ever edit /etc/crontab directly. Usecrontab -e
instead, it will syntax check your edit before writing it to disk, and make the cron deamon reread /etc/crontab, making your change effective immediately. Eventually you can set the environment variable EDITOR to your favourite texteditor, ex.export EDITOR=/bin/nano
if you don't like vi/vim.
– Soren A
Nov 29 at 14:09
@SorenA i tried setting up a cron job usingsudo crontab -e
but it was not working at all. Rather it created crontab with anonymous extension in the/tmp
folder. However, the above method worked as expected.
– Samim
Nov 30 at 5:10
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
accepted
Since there is as of yet no GUI-based cron
controller available for Ubuntu 16.04, we must go back to the old-school methods which always work - do it from the command line:
Official Ubuntu documentation: CronHowto
Selected excerpts:
For guidance, you can always use
man crontab
To edit your cron programs use this command:
crontab -e
From the man page:
Crontab Lines
Each line has five time-and-date fields, followed by a command, followed by a newline character ('n'). The fields are separated by spaces. The five time-and-date fields cannot contain spaces. The five time-and-date fields are as follows: minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday).
01 04 1 1 1 /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on January 1st plus every Monday in January.
An asterisk (*) can be used so that every instance (every hour, every weekday, every month, etc.) of a time period is used.
01 04 * * * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on every day of every month.
Comma-separated values can be used to run more than one instance of a particular command within a time period. Dash-separated values can be used to run a command continuously.
01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 01 and 31 past the hours of 4:00am and 5:00am on the 1st through the 15th of every January and June.
The "/usr/bin/somedirectory/somecommand" text in the above examples indicates the task which will be run at the specified times. It is recommended that you use the full path to the desired commands as shown in the above examples. Enter which somecommand in the terminal to find the full path to somecommand. The crontab will begin running as soon as it is properly edited and saved.
You may want to run a script some number of times per time unit. For example if you want to run it every 10 minutes use the following crontab entry (runs on minutes divisible by 10: 0, 10, 20, 30, etc.)
*/10 * * * * /usr/bin/somedirectory/somecommand
which is also equivalent to the more cumbersome
0,10,20,30,40,50 * * * * /usr/bin/somedirectory/somecommand
Cron also offers some special strings, which can be used in place of the five time-and-date fields:
@reboot
- Run once, at startup.
@yearly
- Run once a year,"0 0 1 1 *"
.
@annually
- (same as@yearly
)
@monthly
- Run once a month,"0 0 1 * *"
.
@weekly
- Run once a week,"0 0 * * 0"
.
@daily
- Run once a day,"0 0 * * *"
.
@midnight
- (same as@daily
)
@hourly
- Run once an hour,"0 * * * *"
.
Note that all cron
jobs begin in the user's $HOME
directory, so it is advisable to use fully-qualified pathnames both in the cron
program and in your scripts.
btw, you can always usecrontab -l
to list your cron jobs.
– SDsolar
Aug 3 '17 at 21:50
add a comment |
up vote
7
down vote
accepted
Since there is as of yet no GUI-based cron
controller available for Ubuntu 16.04, we must go back to the old-school methods which always work - do it from the command line:
Official Ubuntu documentation: CronHowto
Selected excerpts:
For guidance, you can always use
man crontab
To edit your cron programs use this command:
crontab -e
From the man page:
Crontab Lines
Each line has five time-and-date fields, followed by a command, followed by a newline character ('n'). The fields are separated by spaces. The five time-and-date fields cannot contain spaces. The five time-and-date fields are as follows: minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday).
01 04 1 1 1 /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on January 1st plus every Monday in January.
An asterisk (*) can be used so that every instance (every hour, every weekday, every month, etc.) of a time period is used.
01 04 * * * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on every day of every month.
Comma-separated values can be used to run more than one instance of a particular command within a time period. Dash-separated values can be used to run a command continuously.
01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 01 and 31 past the hours of 4:00am and 5:00am on the 1st through the 15th of every January and June.
The "/usr/bin/somedirectory/somecommand" text in the above examples indicates the task which will be run at the specified times. It is recommended that you use the full path to the desired commands as shown in the above examples. Enter which somecommand in the terminal to find the full path to somecommand. The crontab will begin running as soon as it is properly edited and saved.
You may want to run a script some number of times per time unit. For example if you want to run it every 10 minutes use the following crontab entry (runs on minutes divisible by 10: 0, 10, 20, 30, etc.)
*/10 * * * * /usr/bin/somedirectory/somecommand
which is also equivalent to the more cumbersome
0,10,20,30,40,50 * * * * /usr/bin/somedirectory/somecommand
Cron also offers some special strings, which can be used in place of the five time-and-date fields:
@reboot
- Run once, at startup.
@yearly
- Run once a year,"0 0 1 1 *"
.
@annually
- (same as@yearly
)
@monthly
- Run once a month,"0 0 1 * *"
.
@weekly
- Run once a week,"0 0 * * 0"
.
@daily
- Run once a day,"0 0 * * *"
.
@midnight
- (same as@daily
)
@hourly
- Run once an hour,"0 * * * *"
.
Note that all cron
jobs begin in the user's $HOME
directory, so it is advisable to use fully-qualified pathnames both in the cron
program and in your scripts.
btw, you can always usecrontab -l
to list your cron jobs.
– SDsolar
Aug 3 '17 at 21:50
add a comment |
up vote
7
down vote
accepted
up vote
7
down vote
accepted
Since there is as of yet no GUI-based cron
controller available for Ubuntu 16.04, we must go back to the old-school methods which always work - do it from the command line:
Official Ubuntu documentation: CronHowto
Selected excerpts:
For guidance, you can always use
man crontab
To edit your cron programs use this command:
crontab -e
From the man page:
Crontab Lines
Each line has five time-and-date fields, followed by a command, followed by a newline character ('n'). The fields are separated by spaces. The five time-and-date fields cannot contain spaces. The five time-and-date fields are as follows: minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday).
01 04 1 1 1 /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on January 1st plus every Monday in January.
An asterisk (*) can be used so that every instance (every hour, every weekday, every month, etc.) of a time period is used.
01 04 * * * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on every day of every month.
Comma-separated values can be used to run more than one instance of a particular command within a time period. Dash-separated values can be used to run a command continuously.
01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 01 and 31 past the hours of 4:00am and 5:00am on the 1st through the 15th of every January and June.
The "/usr/bin/somedirectory/somecommand" text in the above examples indicates the task which will be run at the specified times. It is recommended that you use the full path to the desired commands as shown in the above examples. Enter which somecommand in the terminal to find the full path to somecommand. The crontab will begin running as soon as it is properly edited and saved.
You may want to run a script some number of times per time unit. For example if you want to run it every 10 minutes use the following crontab entry (runs on minutes divisible by 10: 0, 10, 20, 30, etc.)
*/10 * * * * /usr/bin/somedirectory/somecommand
which is also equivalent to the more cumbersome
0,10,20,30,40,50 * * * * /usr/bin/somedirectory/somecommand
Cron also offers some special strings, which can be used in place of the five time-and-date fields:
@reboot
- Run once, at startup.
@yearly
- Run once a year,"0 0 1 1 *"
.
@annually
- (same as@yearly
)
@monthly
- Run once a month,"0 0 1 * *"
.
@weekly
- Run once a week,"0 0 * * 0"
.
@daily
- Run once a day,"0 0 * * *"
.
@midnight
- (same as@daily
)
@hourly
- Run once an hour,"0 * * * *"
.
Note that all cron
jobs begin in the user's $HOME
directory, so it is advisable to use fully-qualified pathnames both in the cron
program and in your scripts.
Since there is as of yet no GUI-based cron
controller available for Ubuntu 16.04, we must go back to the old-school methods which always work - do it from the command line:
Official Ubuntu documentation: CronHowto
Selected excerpts:
For guidance, you can always use
man crontab
To edit your cron programs use this command:
crontab -e
From the man page:
Crontab Lines
Each line has five time-and-date fields, followed by a command, followed by a newline character ('n'). The fields are separated by spaces. The five time-and-date fields cannot contain spaces. The five time-and-date fields are as follows: minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday).
01 04 1 1 1 /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on January 1st plus every Monday in January.
An asterisk (*) can be used so that every instance (every hour, every weekday, every month, etc.) of a time period is used.
01 04 * * * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on every day of every month.
Comma-separated values can be used to run more than one instance of a particular command within a time period. Dash-separated values can be used to run a command continuously.
01,31 04,05 1-15 1,6 * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 01 and 31 past the hours of 4:00am and 5:00am on the 1st through the 15th of every January and June.
The "/usr/bin/somedirectory/somecommand" text in the above examples indicates the task which will be run at the specified times. It is recommended that you use the full path to the desired commands as shown in the above examples. Enter which somecommand in the terminal to find the full path to somecommand. The crontab will begin running as soon as it is properly edited and saved.
You may want to run a script some number of times per time unit. For example if you want to run it every 10 minutes use the following crontab entry (runs on minutes divisible by 10: 0, 10, 20, 30, etc.)
*/10 * * * * /usr/bin/somedirectory/somecommand
which is also equivalent to the more cumbersome
0,10,20,30,40,50 * * * * /usr/bin/somedirectory/somecommand
Cron also offers some special strings, which can be used in place of the five time-and-date fields:
@reboot
- Run once, at startup.
@yearly
- Run once a year,"0 0 1 1 *"
.
@annually
- (same as@yearly
)
@monthly
- Run once a month,"0 0 1 * *"
.
@weekly
- Run once a week,"0 0 * * 0"
.
@daily
- Run once a day,"0 0 * * *"
.
@midnight
- (same as@daily
)
@hourly
- Run once an hour,"0 * * * *"
.
Note that all cron
jobs begin in the user's $HOME
directory, so it is advisable to use fully-qualified pathnames both in the cron
program and in your scripts.
edited Aug 3 '17 at 2:11
answered Aug 2 '17 at 20:09
SDsolar
1,45941337
1,45941337
btw, you can always usecrontab -l
to list your cron jobs.
– SDsolar
Aug 3 '17 at 21:50
add a comment |
btw, you can always usecrontab -l
to list your cron jobs.
– SDsolar
Aug 3 '17 at 21:50
btw, you can always use
crontab -l
to list your cron jobs.– SDsolar
Aug 3 '17 at 21:50
btw, you can always use
crontab -l
to list your cron jobs.– SDsolar
Aug 3 '17 at 21:50
add a comment |
up vote
0
down vote
You can't influence the crontab, but there is the Orage Time/Calendar application, usually acitvated in the main menu.
There you can schedule tasks as well.
Double click on the clock, to open the calendar, then double click on a single day.
Select a event, new. Give it a name, here, for example, 'Coffeetime'. Set the time to 11:00.
Now choose tab: Reminder, Application, use: YOUR_PROGRAM_TO_SCHEDULE_HERE Deactivate sound and other unsound options.
Now choose tab: Repetition, Frequency:
- daily, weekly, monthly, yearly
- 1 for every (day, for example), 2 for every other day and so on
- more options are available (interval to pause, i.e.)
I have a German UI, so maybe my translation for the tabs doesn't fit exactly.
add a comment |
up vote
0
down vote
You can't influence the crontab, but there is the Orage Time/Calendar application, usually acitvated in the main menu.
There you can schedule tasks as well.
Double click on the clock, to open the calendar, then double click on a single day.
Select a event, new. Give it a name, here, for example, 'Coffeetime'. Set the time to 11:00.
Now choose tab: Reminder, Application, use: YOUR_PROGRAM_TO_SCHEDULE_HERE Deactivate sound and other unsound options.
Now choose tab: Repetition, Frequency:
- daily, weekly, monthly, yearly
- 1 for every (day, for example), 2 for every other day and so on
- more options are available (interval to pause, i.e.)
I have a German UI, so maybe my translation for the tabs doesn't fit exactly.
add a comment |
up vote
0
down vote
up vote
0
down vote
You can't influence the crontab, but there is the Orage Time/Calendar application, usually acitvated in the main menu.
There you can schedule tasks as well.
Double click on the clock, to open the calendar, then double click on a single day.
Select a event, new. Give it a name, here, for example, 'Coffeetime'. Set the time to 11:00.
Now choose tab: Reminder, Application, use: YOUR_PROGRAM_TO_SCHEDULE_HERE Deactivate sound and other unsound options.
Now choose tab: Repetition, Frequency:
- daily, weekly, monthly, yearly
- 1 for every (day, for example), 2 for every other day and so on
- more options are available (interval to pause, i.e.)
I have a German UI, so maybe my translation for the tabs doesn't fit exactly.
You can't influence the crontab, but there is the Orage Time/Calendar application, usually acitvated in the main menu.
There you can schedule tasks as well.
Double click on the clock, to open the calendar, then double click on a single day.
Select a event, new. Give it a name, here, for example, 'Coffeetime'. Set the time to 11:00.
Now choose tab: Reminder, Application, use: YOUR_PROGRAM_TO_SCHEDULE_HERE Deactivate sound and other unsound options.
Now choose tab: Repetition, Frequency:
- daily, weekly, monthly, yearly
- 1 for every (day, for example), 2 for every other day and so on
- more options are available (interval to pause, i.e.)
I have a German UI, so maybe my translation for the tabs doesn't fit exactly.
answered Feb 23 at 6:07
user unknown
4,85122151
4,85122151
add a comment |
add a comment |
up vote
-1
down vote
If it matters to anybody then in the Terminal, type nano /etc/crontab
The default crontab will contain the following lines:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
Move the cursor to the end of the line and write our cron job like below which will run after every 10 minutes
*/10 * * * * root /usr/bin/curl https://www.google.com
If you want to use session, then you need to store and retrieve cookies data to and from a file like,
*/10 * * * * root /usr/bin/curl -c /tmp/cron-session-cookies.txt -b /tmp/cron-session-cookies.txt --silent https://www.google.com >/dev/null 2>&1
New contributor
Don't ever edit /etc/crontab directly. Usecrontab -e
instead, it will syntax check your edit before writing it to disk, and make the cron deamon reread /etc/crontab, making your change effective immediately. Eventually you can set the environment variable EDITOR to your favourite texteditor, ex.export EDITOR=/bin/nano
if you don't like vi/vim.
– Soren A
Nov 29 at 14:09
@SorenA i tried setting up a cron job usingsudo crontab -e
but it was not working at all. Rather it created crontab with anonymous extension in the/tmp
folder. However, the above method worked as expected.
– Samim
Nov 30 at 5:10
add a comment |
up vote
-1
down vote
If it matters to anybody then in the Terminal, type nano /etc/crontab
The default crontab will contain the following lines:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
Move the cursor to the end of the line and write our cron job like below which will run after every 10 minutes
*/10 * * * * root /usr/bin/curl https://www.google.com
If you want to use session, then you need to store and retrieve cookies data to and from a file like,
*/10 * * * * root /usr/bin/curl -c /tmp/cron-session-cookies.txt -b /tmp/cron-session-cookies.txt --silent https://www.google.com >/dev/null 2>&1
New contributor
Don't ever edit /etc/crontab directly. Usecrontab -e
instead, it will syntax check your edit before writing it to disk, and make the cron deamon reread /etc/crontab, making your change effective immediately. Eventually you can set the environment variable EDITOR to your favourite texteditor, ex.export EDITOR=/bin/nano
if you don't like vi/vim.
– Soren A
Nov 29 at 14:09
@SorenA i tried setting up a cron job usingsudo crontab -e
but it was not working at all. Rather it created crontab with anonymous extension in the/tmp
folder. However, the above method worked as expected.
– Samim
Nov 30 at 5:10
add a comment |
up vote
-1
down vote
up vote
-1
down vote
If it matters to anybody then in the Terminal, type nano /etc/crontab
The default crontab will contain the following lines:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
Move the cursor to the end of the line and write our cron job like below which will run after every 10 minutes
*/10 * * * * root /usr/bin/curl https://www.google.com
If you want to use session, then you need to store and retrieve cookies data to and from a file like,
*/10 * * * * root /usr/bin/curl -c /tmp/cron-session-cookies.txt -b /tmp/cron-session-cookies.txt --silent https://www.google.com >/dev/null 2>&1
New contributor
If it matters to anybody then in the Terminal, type nano /etc/crontab
The default crontab will contain the following lines:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
Move the cursor to the end of the line and write our cron job like below which will run after every 10 minutes
*/10 * * * * root /usr/bin/curl https://www.google.com
If you want to use session, then you need to store and retrieve cookies data to and from a file like,
*/10 * * * * root /usr/bin/curl -c /tmp/cron-session-cookies.txt -b /tmp/cron-session-cookies.txt --silent https://www.google.com >/dev/null 2>&1
New contributor
New contributor
answered Nov 29 at 13:20
Samim
992
992
New contributor
New contributor
Don't ever edit /etc/crontab directly. Usecrontab -e
instead, it will syntax check your edit before writing it to disk, and make the cron deamon reread /etc/crontab, making your change effective immediately. Eventually you can set the environment variable EDITOR to your favourite texteditor, ex.export EDITOR=/bin/nano
if you don't like vi/vim.
– Soren A
Nov 29 at 14:09
@SorenA i tried setting up a cron job usingsudo crontab -e
but it was not working at all. Rather it created crontab with anonymous extension in the/tmp
folder. However, the above method worked as expected.
– Samim
Nov 30 at 5:10
add a comment |
Don't ever edit /etc/crontab directly. Usecrontab -e
instead, it will syntax check your edit before writing it to disk, and make the cron deamon reread /etc/crontab, making your change effective immediately. Eventually you can set the environment variable EDITOR to your favourite texteditor, ex.export EDITOR=/bin/nano
if you don't like vi/vim.
– Soren A
Nov 29 at 14:09
@SorenA i tried setting up a cron job usingsudo crontab -e
but it was not working at all. Rather it created crontab with anonymous extension in the/tmp
folder. However, the above method worked as expected.
– Samim
Nov 30 at 5:10
Don't ever edit /etc/crontab directly. Use
crontab -e
instead, it will syntax check your edit before writing it to disk, and make the cron deamon reread /etc/crontab, making your change effective immediately. Eventually you can set the environment variable EDITOR to your favourite texteditor, ex. export EDITOR=/bin/nano
if you don't like vi/vim.– Soren A
Nov 29 at 14:09
Don't ever edit /etc/crontab directly. Use
crontab -e
instead, it will syntax check your edit before writing it to disk, and make the cron deamon reread /etc/crontab, making your change effective immediately. Eventually you can set the environment variable EDITOR to your favourite texteditor, ex. export EDITOR=/bin/nano
if you don't like vi/vim.– Soren A
Nov 29 at 14:09
@SorenA i tried setting up a cron job using
sudo crontab -e
but it was not working at all. Rather it created crontab with anonymous extension in the /tmp
folder. However, the above method worked as expected.– Samim
Nov 30 at 5:10
@SorenA i tried setting up a cron job using
sudo crontab -e
but it was not working at all. Rather it created crontab with anonymous extension in the /tmp
folder. However, the above method worked as expected.– Samim
Nov 30 at 5:10
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f942401%2fhow-to-control-cron-in-ubuntu-16-04-lts%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
github.com/alseambusher/crontab-ui might be an option for you
– Rinzwind
Aug 2 '17 at 20:11
OK, I got nodejs 8 installed, then used npm to install crontab-ui. But now when I type crontab-ui I get the error: /usr/bin/env: ‘node’: No such file or directory - so I see why you said it "might" be an option
– SDsolar
Aug 3 '17 at 2:08
The good news is that it all uninstalled cleanly. Thanks for the tip; too bad it didn't work out.
– SDsolar
Aug 3 '17 at 6:22