Skip to content

Commit 4ddf501

Browse files
committed
Added check for services blocked on a file lock
1 parent 29e4fab commit 4ddf501

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

utilities/de-telstra

+16
Original file line numberDiff line numberDiff line change
@@ -20662,6 +20662,22 @@ fi
2066220662
#endregion Guest Wi-Fi
2066320663

2066420664
#region Services
20665+
echo [$SCRIPT]: Checking for services blocked on a file lock...
20666+
services=$(mktemp)
20667+
for pid in $(pgrep flock); do
20668+
ppid=$(grep -i ^PPId /proc/$pid/status | cut -d: -f2 | xargs)
20669+
command=$(ps | grep -E "\b${ppid}\b" | grep -v grep | tr -s ' ' | cut -d' ' -f5-)
20670+
service=$(basename $(echo $command | grep -oE '/etc/init.d/[^ ]*'))
20671+
[ -z "$__VERBOSE" ] && echo -e "[$SCRIPT]: ${GREY} -> Found blocked command: $command [PID $ppid blocked by PID $pid]${NC}"
20672+
grep -q "^$service" $services || echo $service >> $services
20673+
sed -e "s|^\b$service\b.*|& $pid $ppid|" -i $services
20674+
done
20675+
cat $services | while read service pids; do
20676+
[ -z "$__VERBOSE" ] && echo -e "[$SCRIPT]: ${GREY} -> Deleting /var/lock/procd_$service.lock${NC}"
20677+
rm -f /var/lock/procd_$service.lock
20678+
[ -z "$__VERBOSE" ] && echo -e "[$SCRIPT]: ${GREY} -> Killing process IDs: $pids${NC}"
20679+
kill $pids
20680+
done
2066520681
echo [$SCRIPT]: Applying service changes...
2066620682
[ "$__LITE" = 'R' ] && {
2066720683
for s in cupsd dumaos mesh_broker mmpbxfwctl mmpbxd mmpbxbrcmdect mud multiap_agent multiap_controller multiap_vendorextensions ndhttpd telemetry-daemon xl2tpd; do

0 commit comments

Comments
 (0)