Skip to content

Instantly share code, notes, and snippets.

@justbuchanan
Last active October 24, 2016 01:48
Show Gist options
  • Save justbuchanan/0b7ef521049bfd38b8ee9ed67aeacc38 to your computer and use it in GitHub Desktop.
Save justbuchanan/0b7ef521049bfd38b8ee9ed67aeacc38 to your computer and use it in GitHub Desktop.
[test]
command=$SCRIPT_DIR/test.py
interval=persist
signal=1
#!/usr/bin/env python3
import signal
import time
import sys
# call reload() when RTMIN+1 signal is received
def reload(sig, hdl):
print('reload')
sys.stdout.flush()
with open('signallog', 'w') as f:
f.write("received signal 1")
signal.signal(signal.SIGRTMIN+1, reload)
# wait
while True:
time.sleep(10)
#!/usr/bin/env bash
SCRIPT_DIR=$(pwd) i3blocks -c config -vv > blocklog 2>&1 &
pkill -RTMIN+1 -f 'i3blocks -c config -vv'
sleep 5
$EDITOR blocklog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment