Ont (short for ontime) is a cronjob-like command line tool featuring simpler commands and more robust job management. With ont, you can store jobs in a database, stop them, and restart them at any time.
This project is in the beta phase, and using it in production environments is not recommended at the moment. However, we would appreciate it if you could test it and provide feedback.
Note: The admin need to be either root user or sudo user.
- Install ont on a server (check the installation guide).
- Run the script initOnt.sh to create the DB, choose the DB password, and initialze ontd.
$ wget <script path> $ chmod +x init_ont.sh $ ./initOnt.sh
- Modify the default values in the file
/etc/ont/ont.conf
as per the environment requirements.- Start the ont daemon as follows:
$ ont daemon
The ont daemon can also be started using systemd:
$ systemctl status ontd.service
If the file ontd.service doesn't exist, please create it and start the service. You can find a sample in ontd.service file.
$ ont -v
$ ont -h
Using ont
as a user is pretty simple, you just need to run one of the subcommands and pass the arguments.
To submit a job:
$ ont run --every 1d --from now /path/to/script.sh
This will execute the script script.sh
every day (1d) starting from now (now). Using now
will execute the job immediately once, and then the next execution will be the following day at the same time. You can also pass a specific time or date. More examples can be found in the help output of the command.
$ ont run -h
To list all the jobs:
$ ont list
To start/stop/remove a job. You can use one of the subcommands start
, stop
, remove
and pass the jobid.
$ ont start <jobID>
You can also run a job on a remote server by passing the name or the IP address of the remote server to the run
subcommand.
$ ont run -e 1d -f now -n node001 /path/to/script.sh
This will execute the script script.sh
on the node node001
every day starting from now.
Install the binary as follows:
$ go install -v github.com/ontime-dev/ont@latest
Download the initOnt.sh script:
$ wget https://raw.githubusercontent.com/ontime-dev/ont/main/scripts/initOnt.sh
Set the script as executable:
$ chmod +x initOnt.sh
Execute it to setup ont:
$ ./initOnt.sh
That's it, ont is installed now. You can modify the configuration parameters in ont.conf as required, and then start the daemon:
$ <path/to/ont> daemon
You can also create a ontd.service file and enable it using systemctl:
$ systemctl enable --now ontd.service