fickit: add helper script to simplify nsenter

This commit is contained in:
nemunaire 2019-01-19 14:34:07 +01:00
commit 9784310dc0
5 changed files with 49 additions and 0 deletions

19
configs/nsenter_iptables.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
if [ -d /containers/onboot/004-admin-ip-setup ]; then
LOWER=/containers/onboot/004-admin-ip-setup
elif [ -d /containers/onboot/004-nginx-ip-setup ]; then
LOWER=/containers/onboot/004-nginx-ip-setup
else
nsenter -t 1 -a "$0" $@
exit $?
fi
mount -t tmpfs none $LOWER/run
chroot $LOWER iptables $@
EXIT=$?
umount $LOWER/run
exit ${EXIT}

3
configs/nsenter_mysql.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
nsenter -t $(pgrep mysql | head -1) -a mysql $@

7
configs/nsenter_process.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
PROC="$1"
shift
nsenter -t $(pgrep "$PROC" | head -1) $@
exit $?