12 lines
256 B
Bash
Executable File
12 lines
256 B
Bash
Executable File
#!/bin/sh
|
|
|
|
case $1 in
|
|
stop) rm -f /tmp/timer.txt \
|
|
&& echo stopped
|
|
;;
|
|
*) [ -f /tmp/timer.txt ] \
|
|
&& echo $(( $(date +%s) - $(</tmp/timer.txt) )) \
|
|
|| ( date +%s > /tmp/timer.txt && echo started )
|
|
;;
|
|
esac
|