Add custom script at startup

It’s possible to add a custom script at startup?

It’s very easy actually… that’s possible by using chkconfig command, but there’s another choice? as example using the bigstart command?

Thanks!

In BIG-IP 4.x, the only supported method for running startup scripts was using /config/startup. This is described in SOL3689:

SOL3689: Routes are removed from the /etc/netstart and /config/routes files after upgrading

I couldn’t find a related solution for 9 or 10 though but the file exists and is run at boot.

cat /config/startup

NOTE:

This file will be installed in /config/startup and it will

be called by /etc/rc.local.

- /config/startup is for customer config additions and

will be saved in UCS and configsynced.

- /etc/rc.local should *not* be used by customers and

can/will be changed by F5

Aaron

Ok…

Now i’m using this file to launch the script at startup, I’ve just added the next line:

/bin/log_to_file &

Without the ampersand the BIG-IP hangs-up at boot because the script is an infinite loop to send the content of a file to another.

With the ampersand it boots correctly but executing “ps -fea” command the script is not in the list, but obviously is executed at startup (because of the “hang” without the &)

Anybody knows what’s wrong with this?

Thanks

What is the actual content of the /bin/log_to_file script?

Aaron

The code is the next:

if [ -e /config/file.pipe ]; then  
     while [ -e /config/file.pipe ]  
     do  
         tail -f /var/log/wa/access/file.log > /config/file.pipe  
     done  
 else  
     mkfifo /config/file.pipe  
 fi

It’s related with this post.

http://devcentral.f5.com/Default.aspx?tabid=53&forumid=31&postid=85477&view=topic

I use the script to send the WA log files to a pipe; that pipe is used finally as a source to syslog-ng config file.

It should be an infinite loop, but it seems that it isn’t.

Thanks

Maybe there is an error with the script? If you run it from the command line, does it run successfully? If so, can you try redirecting the stderr and stdout to a file from /config/startup?

cat /config/startup

/bin/log_to_file & >> /var/tmp/log_to_file.out 2>&1

Aaron

Executed trough command line it works perfect (at least it keeps running and no error are shown) maybe the execution at boot time will be different.

I will test the redirections and I will tell you the results.