Looking for option to run script at startup and shutdown


Julius

Recommended Posts

So far I've used the go script to overwrite /etc/ssh and /root dirs with my own keys and config for shell, and persistent .bash_history file and such, like so;

# force overwrite root config to /root/ and etc/ssh and set permissions
cp -af /boot/config/xroot/. /root/
cp -af /boot/config/xssh/. /etc/ssh/
chmod -R 0700 /root
chmod 0600 /root/.ssh/*
chmod 0644 /etc/ssh/*

and then I manually rsync to update them from time to time, like so;

rsync -qua --min-size=1 --no-specials --no-devices --no-links /root/* /boot/config/xroot
rsync -qua --min-size=1 --no-specials --no-devices --no-links /etc/ssh/* /boot/config/xssh

but that last bit I would like to be able to perform automagically at shutdown or reboot. Any good spot for this?

Edited by Julius
Link to comment
12 hours ago, Squid said:

User scripts plugin. Schedule run at array stopping or array starting

Sent from my NSA monitored device
 

Yes, that will do, thanks!

Regarding ssh, do you know if it's easy to change the code that keeps updating the /etc/ssh content after each restart of sshd? I mean, even that last bit of my previous post (updating the source that I use to overwrite the ssh) isn't fail-safe, because I found out the hard way that unRAID updated the keys without me knowing. If someone at unRAID core is reading; could you please make that an Advanced option? Something like

"Leave /etc/ssh alone after initial ramdisk creation and sshd restarts [x]"

would help us a lot.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.