Skip to content

Commit

Permalink
Update smart.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
didinau authored Apr 15, 2024
1 parent d955a84 commit c5ecd41
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions bin/smart.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
#!/bin/bash

# Edit vars:
#
# user user name z.B. "pi"
#
# wdir source path z.B. "/usr/local/energie"
#
#
#

user="myadmin"

wdir="/usr/local/energie"

wlog="$wdir/log/smart.log"

cd $wdir/log
cd "$wdir/log"

if [ "$1" != "daemon" ]; then
su -c "$0 daemon" myadmin
su -c "$0 daemon" "$user"
else
(
exec 2>&1
exec 1>> $wlog
exec 1>>"$wlog"
exec 0</dev/null

export PATH="/usr/local/bin:$PATH"

#PHP="php-dist"
PHP="php"

while true
do
if [ -s $wdir/log/smart.log ]; then
cp $wlog ${wlog}.old
if [ -s "$wlog" ]; then
cp "$wlog" "${wlog}.old"
fi
>$wlog
$PHP $wdir/bin/smart.php 1>>$wlog 2>&1
> "$wlog"
$PHP $wdir/bin/smart.php 1>>"$wlog" 2>&1
sleep 10
done
) &
Expand Down

0 comments on commit c5ecd41

Please sign in to comment.