Is this the best way to start Oracle?

[root@localhost system]# cat oracle-foo.service
[Unit]
Description=oracle db - foo
After=syslog.target

[Service]
Environment=ORACLE_SID=foo ORACLE_HOME=/home/oracle/Ora12c/db
ExecStart=/bin/ksh -c 'print "connect / as sysdba \n startup \n quit" | 
$ORACLE_HOME/bin/sqlplus -silent /nolog'
ExecStop=/bin/ksh -c 'print "connect / as sysdba \n shutdown immediate \n quit" 
| $ORACLE_HOME/bin/sqlplus -silent /nolog'
Type=forking
User=oracle
Group=dba

[Install]
WantedBy=multi-user.target

#This file should be placed in /etc/systemd/system
#enable for start at boot by: systemctl enable oracle_db-foo.service

I used to do it with an init.d script that grabbed the SID out of argv[0] with 
ORACLE_SID=${0##*-} - I'm assuming that a systemd service file can't grab 
anything similarly out of argv[0], and I can't hard-link them all together.

I may have several instances on a machine; I'd like one service to start/stop 
everything if possible (maybe with dbstart/dbshut), but I also want granular 
control over each Oracle instance.


_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to