0

With the old good SystemV scripts, if I want something before shutdown, I put a script like this in /etc/rc0.d/

K400rc.local.shutdown.sh

And I edit it and put my commands which I want to run before shutdown. On linux with systemd I have created a "manifest" like this

vim /lib/systemd/system/rc-local-shutdown.service

[Unit]
Description=/etc/rc.local.shutdown Compatibility
ConditionFileIsExecutable=/etc/rc.local.shutdown
DefaultDependencies=no
After=rc-local.service basic.target
Before=shutdown.target reboot.target

[Service]
Type=oneshot
ExecStart=/etc/rc.local.shutdown
StandardInput=tty
RemainAfterExit=yes

[Install]
WantedBy=shutdown.target

Works very good..and before shutdown I can put my commands. The question is..someone know how to do a manifest like this with Solaris smf? I know how to do a rc.local but not to do a rc.local.shutdown manifest. Someone know?

elbarna
  • 12,050
  • 22
  • 92
  • 170
  • [van Smoorenburg `rc` is not AT&T System 5, and the _actual_ AT&T Unix System 5 replaced `rc.local` with a new system](http://jdebp.eu./FGA/rc.local-is-history.html). – JdeBP Feb 14 '19 at 09:25

1 Answers1

2

Solaris smf is honoring legacy scripts so your /etc/rc0.d/K400rc.local.shutdown.sh will be executed at shutdown. The prefix K40 and the suffix .share the only parts that matter, the remaining 0rc.local.shutdown has no meaning for the OS.

Should you want to convert this task to a smf service, instead of thinking in term of shutdown and run levels, better to identify what your service will depend on (your service will stop after the selected service ends).

Then create a manifest with a no-op start exec-method and using your shutdown script as stop exec-method.

jlliagre
  • 60,319
  • 10
  • 115
  • 157