-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major update: introduction of running monitor.py infinitely
- Loading branch information
1 parent
1e1b506
commit 84f6482
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[loggers] | ||
keys=root | ||
|
||
[handlers] | ||
keys=stdout | ||
|
||
[formatters] | ||
keys=simpleFormatter | ||
|
||
[logger_root] | ||
level=INFO | ||
handlers=stdout | ||
|
||
[handler_stdout] | ||
class=StreamHandler | ||
formatter=simpleFormatter | ||
args=(sys.stdout,) | ||
|
||
[formatter_simpleFormatter] | ||
format=%(asctime)s: %(levelname)s: %(message)s | ||
datefmt=%Y%m%d %H:%M:%S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
# --------------------------------------------------------------- | ||
# A script to run monitor infinite. | ||
# if still running, do not start new one | ||
# Assumption is that monitor.cfg is configured to run infinite (monitor_infinite = True) and | ||
# monitor_execute_commands_when_something_written_or_error is configured to run summary.py and/or dailystats.py, e.g. | ||
# monitor_execute_commands_when_something_written_or_error = python -u summary.py sheetupdate > summary.log;python -u dailystats.py sheetupdate > dailystats.log | ||
# Add to your crontab to run once per hour to restart after crashes or reboot | ||
# 0 * * * * ~/hyundai_kia_connect_monitor/run_monitor_infinite.sh >> ~/hyundai_kia_connect_monitor/crontab_run_monitor_infinite.log 2>&1 | ||
# --------------------------------------------------------------- | ||
script_name=$(basename -- "$0") | ||
cd ~/hyundai_kia_connect_monitor | ||
|
||
now=$(date) | ||
if pidof -x "$script_name" -o $$ >/dev/null | ||
then | ||
echo "$now: $script_name still running" | ||
else | ||
echo "$now: starting $script_name" >> run_monitor_infinite.log | ||
/usr/bin/python -u ~/hyundai_kia_connect_monitor/monitor.py >> run_monitor_infinite.log 2>&1 | ||
now=$(date) | ||
echo "$now: $script_name exited" >> run_monitor_infinite.log | ||
fi |