Commit 1f6b7f9d authored by nextime's avatar nextime

Configure wssshd and wssshc init scripts to redirect output to log files managed by logrotate

- Add wssshd.log and wssshc.log to respective logrotate configurations
- Modify init scripts to redirect stdout and stderr to log files
- Ensure proper log rotation with weekly rotation, compression, and HUP signals
parent 51f99873
/var/log/wssshd/wssshd.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 644 wssshd wssshd
postrotate
if [ -f /var/run/wssshd.pid ]; then
kill -HUP $(cat /var/run/wssshd.pid) 2>/dev/null || true
fi
endscript
}
/var/log/wssshd/watchdog.log {
weekly
missingok
......
......@@ -142,7 +142,7 @@ start() {
# Start the daemon directly
echo "Starting daemon..."
if "$DAEMON" &
if "$DAEMON" >> /var/log/wssshc/wssshc.log 2>&1 &
then
echo $! > "$PIDFILE"
echo "Daemon started successfully"
......
......@@ -87,11 +87,11 @@ start() {
echo "Starting daemon..."
if start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
--chuid $USER:$GROUP --background --make-pidfile \
--exec "$DAEMON" 2>/dev/null; then
--exec "$DAEMON" --stdout /var/log/wssshd/wssshd.log --stderr /var/log/wssshd/wssshd.log; then
echo "Daemon started successfully"
else
echo "start-stop-daemon failed, trying direct execution..."
if "$DAEMON" &
if "$DAEMON" >> /var/log/wssshd/wssshd.log 2>&1 &
then
echo $! > "$PIDFILE"
echo "Daemon started successfully (direct execution)"
......
/var/log/wssshc/wssshc.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 644 wssshc wssshc
postrotate
if [ -f /var/run/wssshc.pid ]; then
kill -HUP $(cat /var/run/wssshc.pid) 2>/dev/null || true
fi
endscript
}
/var/log/wssshc/watchdog.log {
weekly
missingok
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment