projects
/
weathermon.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
de2440e
)
Добавлено разумности при определении состояния временной базы данных (теперь нужен...
author
Roman Bazalevsky
<rvb@rvb.name>
Fri, 16 Nov 2018 10:52:23 +0000
(13:52 +0300)
committer
Roman Bazalevsky
<rvb@rvb.name>
Fri, 16 Nov 2018 10:52:23 +0000
(13:52 +0300)
init.d/weathermon
patch
|
blob
|
history
diff --git
a/init.d/weathermon
b/init.d/weathermon
index 802529e5eac7c880abd2941fecd6c34ad71825a4..b57d620cd633a2b8436c698685d583a7db90473e 100755
(executable)
--- a/
init.d/weathermon
+++ b/
init.d/weathermon
@@
-18,14
+18,26
@@
start_service() {
mkdir -p "$WORK_DIR"
mkdir -p "$WORK_DIR"
- if [ ! -z "$BACKLOGDB" ] && [ ! -f "$BACKLOGDB" ]; then
- BACKLOG_BASE=$(basename "$BACKLOGDB")
- cp "$BACKUP_DIR/$BACKLOG_BASE" "$BACKLOGDB"
+ if [ ! -z "$BACKLOGDB" ]; then
+
+ sqlite3 $BACKLOGDB "select * from queue limit 1" > /dev/null
+
+ if [ "$?" != "0" ]; then
+ BACKLOG_BASE=$(basename "$BACKLOGDB")
+ cp "$BACKUP_DIR/$BACKLOG_BASE" "$BACKLOGDB"
+ fi
+
fi
fi
- if [ ! -z "$LOGDB" ] && [ ! -f "$LOGDB" ]; then
- LOG_BASE=$(basename "$LOGDB")
- cp "$BACKUP_DIR/$LOG_BASE" "$LOGDB"
+ if [ ! -z "$LOGDB" ]; then
+
+ sqlite3 $LOGDB "select * from log limit 1" > /dev/null
+
+ if [ "$?" != "0" ]; then
+ LOG_BASE=$(basename "$LOGDB")
+ cp "$BACKUP_DIR/$LOG_BASE" "$LOGDB"
+ fi
+
fi
procd_open_instance
fi
procd_open_instance