Worst implementation --daemon mode for files interact

This commit is contained in:
localhost_frssoft 2022-08-05 23:58:57 +03:00
parent d29a97b19c
commit d8e6271d8f

View file

@ -979,6 +979,24 @@ custom_manual_api_request()
done
}
if [ "$1" = '--daemon' ]; then
echo "Daemon mode started; files listening..."
while true; do
sleep 5
statuses_to_fav=$(/bin/ls $main_basedir/all_statuses/$instance/*/favourite 2>/dev/null)
statuses_to_share=$(/bin/ls $main_basedir/all_statuses/$instance/*/share 2>/dev/null)
if [ -n "$statuses_to_fav" ]; then
status_id=$(dirname "$statuses_to_fav" | sed 's/.*\///g')
favorite_api_status $status_id
rm $statuses_to_fav
fi
if [ -n "$statuses_to_share" ]; then
status_id=$(dirname "$statuses_to_share" | sed 's/.*\///g')
share_api_status $status_id
rm $statuses_to_share
fi
done
fi
menu_write_status='Write status'
menu_timeline='Timelines'
notif='Notifications'