Changes

Jump to navigation Jump to search
1,580 bytes added ,  20:53, 9 April 2014
Line 649: Line 649:     
===allow a service to start for a particular time===
 
===allow a service to start for a particular time===
 +
If your package implements a server or daemon, you will probably want it to be started automatically when the system boots.
   −
in this way SME's knows how to/if start the service at startup
+
The SME Server boots in runlevel 7, so you can get an idea of the startup processes by listing the contents of /etc/rc.d/rc7.d.
   −
  config set myapplicationname service status enabled
+
These are similar to the init scripts you may be familiar with from other Linux systems, with one important difference. Instead of pointing to scripts within /etc/rc.d/init.d, all of those init entries are links to /etc/rc.d/init.d/e-smith-service. This is a wrapper which checks the configuration database to see if the service is supposed to be running and if so, starts the service from /etc/rc.d/init.d/whatever.
 +
 
 +
So for example, you might have:
 +
 
 +
S90squid -> /etc/rc.d/init.d/e-smith-service
 +
 
 +
The e-smith-service script looks up the name it was invoked with (S90squid), drops the prefix (leaving squid), checks the configuration database for the "squid" service, then if it's supposed to run, does:
 +
 
 +
/etc/rc.d/init.d/squid start
 +
 
 +
* with this way SME's knows how to/if start the service at startup
 +
 
 +
  config set '''myapplicationname''' service status enabled
    
  cd /etc/rc.d/init.d
 
  cd /etc/rc.d/init.d
  ln -s /path/to/myinitscript myapplicationname
+
  ln -s /path/to/myinitscript '''myapplicationname'''
   −
'''We are creating a symlink of the original startup script with a new name (the point is that myapplicationname must be identical to the service name above)'''
+
'''We are creating a symlink of the original startup script with a new name (the point is that '''myapplicationname''' must be identical to the service name above)'''
    
  cd /etc/rc7.d
 
  cd /etc/rc7.d
  ln -s  /etc/rc.d/init.d/e-smith-service SXXmyapplicationname
+
  ln -s  /etc/rc.d/init.d/e-smith-service '''SXXmyapplicationname'''
    
we create a symlink to e-smith-service startup script with a name where: S tells SME to start XX are numbers
 
we create a symlink to e-smith-service startup script with a name where: S tells SME to start XX are numbers
   −
you can decide when to start the service myapplicationname, but you should not start something that need the network before the network itself is up and running.
+
You can decide when to start the service '''myapplicationname''', but you should not start something that need the network before the network itself is up and running.
 
Therefore you can see the content of /etc/rc7.d and see which scripts are needed to execute your new startup script
 
Therefore you can see the content of /etc/rc7.d and see which scripts are needed to execute your new startup script
 +
signal-event remoteaccess-update
 +
service myapplicationname start
 +
====Creating or deleting a service====
 +
 +
*Creating and starting service
 +
 +
ln -f -s /etc/rc.d/init.d/e-smith-service /etc/rc7.d/S98popfile
 +
/sbin/e-smith/db configuration set popfile service status enabled
 +
/sbin/e-smith/signal-event remoteaccess-update
 +
service popfile start
 +
 +
*Deleting and unregistering service
 +
 +
service popfile stop
 +
sleep 3
 +
rm -f /etc/rc7.d/S98popfile
 +
rm -f /etc/rc.d/init.d/popfile
 +
/sbin/e-smith/config delete popfile
 +
/sbin/e-smith/signal-event remoteaccess-update
    
==Squid Cache==
 
==Squid Cache==

Navigation menu