Fix install and uninstall permanent SSH
parent
82a40aa2b3
commit
e74eb9569c
@ -1,16 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$( grep 'ssh_patch.sh' /etc/crontabs/root )" != "" ]; then
|
||||
sh /tmp/ssh_uninstall.sh
|
||||
if [ -e "/tmp/ssh_uninstall.sh" ]; then
|
||||
sh /tmp/ssh_uninstall.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
mv -f /tmp/ssh_patch.sh /etc/crontabs/
|
||||
chmod +x /etc/crontabs/ssh_patch.sh
|
||||
if [ ! -d /etc/crontabs/patches/ ]; then
|
||||
mkdir /etc/crontabs/patches/
|
||||
chown root /etc/crontabs/patches/
|
||||
chmod 0755 /etc/crontabs/patches/
|
||||
fi
|
||||
|
||||
mv -f /tmp/ssh_patch.sh /etc/crontabs/patches/
|
||||
chmod +x /etc/crontabs/patches/ssh_patch.sh
|
||||
|
||||
nvram set ssh_en=1
|
||||
nvram commit
|
||||
|
||||
grep -v "/etc/crontabs/ssh_patch.sh" /etc/crontabs/root > /etc/crontabs/root.new;
|
||||
echo "*/1 * * * * /etc/crontabs/ssh_patch.sh >/dev/null 2>&1" >> /etc/crontabs/root.new
|
||||
grep -v "/ssh_patch.sh" /etc/crontabs/root > /etc/crontabs/root.new
|
||||
echo "*/1 * * * * /etc/crontabs/patches/ssh_patch.sh >/dev/null 2>&1" >> /etc/crontabs/root.new
|
||||
mv /etc/crontabs/root.new /etc/crontabs/root
|
||||
/etc/init.d/cron restart
|
||||
|
@ -1,8 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
grep -v "/etc/crontabs/ssh_patch.sh" /etc/crontabs/root > /etc/crontabs/root.new;
|
||||
grep -v "/ssh_patch.sh" /etc/crontabs/root > /etc/crontabs/root.new
|
||||
mv /etc/crontabs/root.new /etc/crontabs/root
|
||||
/etc/init.d/cron restart
|
||||
|
||||
rm -f /etc/crontabs/ssh_patch.sh
|
||||
rm -f /etc/crontabs/patches/ssh_patch.sh
|
||||
rm -f /tmp/ssh_patch.log
|
||||
|
||||
|
Loading…
Reference in New Issue