Hello,
I've installed Syslog-ng 3, Postgresql 8 and php-syslog-ng
I use a script in order to pipe the output into postgresql.
When I run this script by hand like :
It's OK
The script is :
I've read many post :
A solution I've read it's to put my script in /usr/local/etc/rc.d
The result look's like the script was executed only on time.
(not like a daemon)
So it doesnt work for me.
An other solution I've tested is to writing an other script like this :
Put it in /usr/local/etc/rc.d
And reboot but not working
I'm making an other try by using /etc/crontab
But it doesn't work
Mine last test is to write an rc script looking like this
And to add this syslog_postgres_enable="YES" on /etc/rc.conf
This kind of script don't work for me, with many different test by reading the handbook
What's is the good direction in order to run this script on reboot in the same way like doing this command :
Thank you
I've installed Syslog-ng 3, Postgresql 8 and php-syslog-ng
I use a script in order to pipe the output into postgresql.
When I run this script by hand like :
./usr/local/bin/syslog_postgres.sh &
It's OK
The script is :
Code:
#!/bin/bash
if [ -e /tmp/pgsql.pipe ]; then
while [ -e /tmp/pgsql.pipe ]
do
psql -q -U mydbusername syslog < /tmp/pgsql.pipe
done
else
mkfifo /tmp/pgsql.pipe
fi
I've read many post :
A solution I've read it's to put my script in /usr/local/etc/rc.d
The result look's like the script was executed only on time.
(not like a daemon)
So it doesnt work for me.
An other solution I've tested is to writing an other script like this :
Code:
#!/bin/sh
echo "Starting syslog_postgres"
./usr/local/bin/syslog_postgres.sh &
Put it in /usr/local/etc/rc.d
And reboot but not working
I'm making an other try by using /etc/crontab
Code:
@reboot root usr/local/bin/syslog_postgres.sh
But it doesn't work
Mine last test is to write an rc script looking like this
Code:
#!/bin/sh
#
# PROVIDE: syslog_postgres
. /etc/rc.subr
name="syslog_postgres"
rcvar=`set_rcvar`
command="/usr/local/bin/syslog_postgres"
load_rc_config $name
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
# SET THEM IN THE /etc/rc.conf FILE
#
syslog_postgres_enable=${syslog_postgres_enable-"NO"}
syslog_postgres_pidfile=${syslog_postgres_pidfile-"/var/run/utility.pid"}
pidfile="${syslog_postgres_pidfile}"
run_rc_command "$1"
This kind of script don't work for me, with many different test by reading the handbook
What's is the good direction in order to run this script on reboot in the same way like doing this command :
./usr/local/bin/syslog_postgres.sh &
Thank you