1. Introduction
Provide a timed task management tool with a visual interface.
- Allow to set the timeout period of each script, the timeout operation can choose to notify the manager by email or kill the script process forcefully.
- Allows to set the maximum number of concurrent scripts.
- One server manages multiple clients.
- Each script can be flexibly configured on the server side, such as running test scripts, viewing logs, killing processes, stopping timing...
- Allow adding script dependencies (supporting cross-server), relying on scripts to provide synchronous and asynchronous execution modes.
- Friendly web interface, convenient for users to operate.
- When script error occurs, you can choose email to notify multiple people.
Description
- Jiacrontab consists of two parts: server and client, which communicate completely independently through rpc.
- server: Provide users with a visual interface to schedule multiple clients.
- Client: Realize timing logic, isolate user scripts, and arrange clients on multiple servers to be managed by the server. The timing format of each script is fully compatible with the crontab script configuration format of linux itself.
gitee address: https://gitee.com/iwannay/jiacrontab
git download: https://gitee.com/iwannay/jiacrontab.git
Open source China: https://www.oschina.net/p/jiacrontab?hmsr=aladdin1e1
Two, server and tools
1. System: CentOS-7-x86_64-Minimal-1708
download link:
http://archive.kernel.org/centos-vault/7.4.1708/isos/x86_64/
2. Install the virtual machine
Refer to the installation process:
https://blog.csdn.net/llwy1428/article/details/89328381
3. VMware version: VMware Workstation Pro15
4. Tools: xshell5
5. The virtual machine is connected to the Internet, and the network card and static IP configuration can be referred to:
https://blog.csdn.net/llwy1428/article/details/85058028
6. Configure server time synchronization
https://blog.csdn.net/llwy1428/article/details/89330330
Three, build and configure
1. Install basic tools
[root@localhost ~]# yum install epel-release
[root@localhost ~]# yum install -y vim git net-tools golang
2. Create a directory
[root@localhost ~]# mkdir /opt/jiacrontab
3. Enter the catalog
[root@localhost ~]# cd /opt/jiacrontab/
4. Download files
[root@localhost jiacrontab]# git clone https://gitee.com/iwannay/jiacrontab.git
5. View the catalog
6. Enter the catalog
[root@localhost jiacrontab]# cd /opt/jiacrontab/jiacrontab/
[root@localhost jiacrontab]# make build
7. Enter the directory and view the directory jiacrontab_admin
[root@localhost ~]# cd /opt/jiacrontab/jiacrontab/build/jiacrontab/jiacrontab_admin
8. Start the service
[root@localhost jiacrontab_admin]# nohup ./jiacrontab_admin &> jiacrontab_admin.log &
9. Enter the directory and view the directory jiacrontabd
[root@localhost ~]# cd /opt/jiacrontab/jiacrontab/build/jiacrontab/jiacrontabd
10. Start the service
[root@localhost jiacrontabd]# nohup ./jiacrontabd &> jiacrontabd.log &
11. Check the startup situation
[root@localhost ~]# netstat -lntp
Four, browser view
1. Enter the address http://192.168.11.16:20000/ in the browser ( 192.168.11.16 is the IP of my virtual machine)
Enter user name, password and email information to initialize the user
2. Log in
3. Home page information
4. Node list
5. Group
6. Help
7. Application settings
8. Add users
9. Modify information
Five, basic use
1. Timed tasks
Timeout setting and timeout operation
The timeout operation will be set after the timeout. The default value is 0. The timeout is not judged.
2. Maximum concurrent number
The maximum concurrency number controls the maximum number of processes that can exist in the same job at the same time. The default maximum concurrency number is 1, and the subsequent execution will be abandoned when the current one is not executed.
Prevent scripts from failing to exit normally and cause system resource exhaustion
3. Add dependencies
Dependency means that the dependent script needs to be executed before the user script is executed, and the current script will be executed only after the execution of the dependent script is completed.
(1) Concurrent execution
Concurrent execution of dependent scripts, any script error or timeout will not affect other dependent scripts, but will interrupt the user's job
(2) Synchronous execution
Execute dependent scripts synchronously. The execution order is the order of addition. If a dependent script fails or times out, subsequent dependencies and user jobs will be interrupted.
Script abnormal exit notification If the script exit code is not 0, it is considered an abnormal exit
4. Resident tasks
The resident task checks whether the script process exits, and if it exits, restarts again to ensure that the script runs continuously.
Note: Background processes are not supported.
5. Appendix
(1) Error log
The error log is stored in the directory set by the configuration file
The timing task is logs/crontab_task
The timing task is daemon_task and the log file is exactly ID.log under the date directory (eg: logs/crontab_task/2018/01/01/1.log)
(2) Error log information
Normal error log
Error log generated by the program
Custom error log
Custom output information in the program, you need to add a newline after the output information
So far, Centos7 installation and deployment of jiacrontab web service is complete!