4.5 Using a Unix Service to Manage Daemons
When SQLcl is installed using the RPM package, it includes a
systemd
service (named sql-scheduler
) to centrally
manage SQLcl scheduler daemons for multiple users. This service manages daemons of all users
belonging to a specific Unix group.
- A Unix group named
sql-scheduler
is created if one doesn't exist on the system. - The
oracle
user account is created if it doesn't exist. Additionally, it is added to thesql-scheduler
group.
If you add any other user to the sql-scheduler
group, their scheduler daemon is automatically managed by the
systemd
service.
Note:
Thesystemd
service manages only the users in the sql-scheduler
group.
Other users must manage their daemon manually using the sql
-daemon
commands.
4.5.1 Managing the Service as the Root User
After installing the SQLcl RPM package and ensuring all the required users
are in the sql-scheduler
group, a privileged user (like
root
) can manage the service to centrally control starting and stopping
daemons for the users.
This example demonstrates managing the service as the
root
user to control the scheduler daemon for the
oracle
user.
Check the oracle
User's Group
Confirm that the oracle
user is part of the
sql-scheduler
group.
[root@oracledb23ia ~]$ groups oracle
oracle : oracle oinstall .... sql-scheduler
Check the sql-scheduler
Service Status
Confirm that the sql-scheduler
service is installed.
[root@oracledb23ia ~]$ systemctl status sql-scheduler
sql-scheduler.service - SQLcl scheduler services
Loaded: loaded (/etc/systemd/system/sql-scheduler.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Jun 09 13:02:57 oracledb23ia.localdomain systemd[1]: Started SQLcl scheduler services.
Start the Service
Run the sql-scheduler
service to start the scheduler
daemon for all users in the sql-scheduler
group (in this case, just
the oracle
user).
[root@oracledb23ia ~]$ systemctl start sql-scheduler
[root@oracledb23ia ~]$ systemctl status sql-scheduler
sql-scheduler.service - SQLcl scheduler services
Loaded: loaded (/etc/systemd/system/sql-scheduler.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2025-06-09 13:39:06 CST; 2min 29s ago
Process: 3832 ExecStart=/usr/bin/bash -c /etc/init.d/sql-scheduler start (code=exited, status=0/SUCCESS)
Main PID: 3938 (java)
Tasks: 0 (limit: 36046)
Memory: 64.0K
CGroup: /system.slice/sql-scheduler.service
Check the Service Logs
Use the journalctl
command to view the service logs. All
related logs, schedule configuration files, and runtime data for the
oracle
user are placed in the following location:
/home/oracle/.dbtools/schedules
.
[root@oracledb23ia ~]# journalctl -a -f -u sql-scheduler
Jun 09 13:31:57 oracledb23ia.localdomain systemd[1]: sql-scheduler.service: Succeeded.
Jun 09 13:31:57 oracledb23ia.localdomain systemd[1]: Stopped SQLcl scheduler services.
Jun 09 13:39:02 oracledb23ia.localdomain systemd[1]: Starting SQLcl scheduler services...
Jun 09 13:39:02 oracledb23ia.localdomain bash[3842]: Starting the SQLcl Scheduler Daemon.
Jun 09 13:39:02 oracledb23ia.localdomain bash[3849]: Starting the SQLcl Scheduler Daemon for user oracle.
.....
Stop the Service
Stop the scheduler daemon for managed users (for example, the
oracle
user).
[root@oracledb23ia ~]# systemctl stop sql-scheduler
[root@oracledb23ia ~]# journalctl -a -f -u sql-scheduler
Jun 09 13:39:04 oracledb23ia.localdomain bash[4065]: The SQLcl Scheduler Daemon has started correctly.
Jun 09 13:39:06 oracledb23ia.localdomain systemd[1]: Started SQLcl scheduler services.
Jun 09 14:07:24 oracledb23ia.localdomain systemd[1]: Stopping SQLcl scheduler services...
Jun 09 14:07:24 oracledb23ia.localdomain bash[4497]: Stopping the SQLcl Scheduler Daemon.
Jun 09 14:07:24 oracledb23ia.localdomain bash[4504]: Stopping SQLcl Scheduler Daemon for user oracle