#!/bin/bash TARGET=/etc/OliveTin/entities/containers.yaml TARGET_TEMP=${TARGET}.tmp test -e ${TARGET_TEMP} && rm -f ${TARGET_TEMP} for i in /etc/init.d/user-containers.* do name=${i##*.} $i status 2> /dev/null | grep started > /dev/null if [ $? -eq 0 ] then running=running else running=stopped fi echo " - name: $name state: $running command: $i " >> ${TARGET_TEMP} done test -e ${TARGET_TEMP} && mv ${TARGET_TEMP} ${TARGET}