You run scheduled jobs in Ubuntu (and other Linuxes) using cron. One thing that is important to remember about cron, is that there are "user cron tables" and "system cron tables".
If you want your application to run in the context of a user, then its relatively simple: log in as that user and run crontab -e
. You'd get into an editor where you edit the cron table manually.
Under a user cron table, you have 6 fields:
<minute> <hour> <day-of-month> <month> <day-of-week> <command ...>
The field are space separated except "command
" which extends to the end of the line (with some caveats). Read man 5 crontab
for the gory details.
To run something every day, you might want to choose a time, then program that into the first two fields, leaving all the other fields as asterisk (i.e. "anything goes"). So the expression
1 2 * * * mono /root/Folder/Aplication.exe
Would run your mono application every day (every day of every month regardless of the day of the week - these are the 3 asterisks) at 2:01AM (the first two fields).
Now because I see you've installed your application under /root
I'm assuming you may want to run this app as a system application - which also makes more sense when setting up a server in a VPS anyway. A system crontab is very similar to a user crontab except that is stored in a file under the /etc
directory and it has an additional field specifying under which user you want to run it - which is likely going to be root
. So the expression might look like this:
1 2 * * * root mono /root/Folder/Aplication.exe
and you probably want to put this in a new file you'd create under /etc/cron.d/
- maybe /etc/cron.d/myapp
(note that there is no extension - this is on purpose). Under /etc/
there are several other crontab files and directories, which can be really useful for things like daily runs, such as /etc/cron.daily
- read up on them in the crontab files man page I referenced above.
Notes
- Don't run Ubuntu 12.04 - its super obsolete. Better try 16.04
- Checkout Crontab.Guru for all your crontab expression needs.
crontab -e
- and that can cause all kinds of trouble, not the least of which that the cron daemon will not refresh these files automatically, like it does the system cron tables. – Guss Jan 08 '17 at 19:33