service problem
hello
on a my friend server if I execute service exim start or service exim stop does not work , because doesn't recognize "service" command On my server I use service command daily How to activate service command on his server too ? He has a freebsd server. Thank you |
The service command is only available on Redhat based distributions and derivates. YOu should be able to manage exim by doing something like
Code:
#/usr/local/etc/rc.d/exim start/stop/reload/status/restart |
Thank you I didn't know it
I noticed that also chkconfig --add exim is not avaialble on freebsd How to add or remove a service on frebsd from startup list if chkconfig is not avaialble ? Thank you |
and if possible I need also alternative freebsd to
chattr +i Thank you!! |
Quote:
Code:
exim_enable="YES" |
Moved: This thread is more suitable in *BSD and has been moved accordingly to help your thread/question get the exposure it deserves.
|
May be if we write our own program that act like 'service' and then set PATH to its execute path for System, that could be better. But at this point I am not sure about setting PATH so I can offer only the familiar code only.:)
Code for C Program could be something like below. Note: Save file as service.c Compile with: cc -o service.out service.c Execute with: ./service.out [start/stop/restart] include<stdio.h> int main(int argc, char *argv[]){ //Start exim if(strcmp(argv[0],"start")){ system("/usr/local/etc/rc.d/exim start"); } //Stop Exim else if(strcmp(argv[0],"stop")){ system("/usr/local/etc/rc.d/exim stop"); } //Restart Exim else if(strcmp(argv[0],"restart")){ system("/usr/local/etc/rc.d/exim stop"); system("/usr/local/etc/rc.d/exim start"); } //If the program have more parameter then add your code here.. //.. return 0; } Hope it's useful to you all. If has any method for setting Path to the above program tell me too. Thanks. |
We could use a shell script (it would be more flexible) and we don't even need to complicate it with much at all.
Call this script service: Code:
#!/bin/sh The scripts themselves handle the parsing of the arguments so we don't need to. We just locate the correct script and pass it the arguments. It saves you from having to type the path or locate the script... but I personally don't see it as reducing the complexity... it's just as easy to type the path. |
All times are GMT -5. The time now is 02:04 AM. |