Starting and Stopping Services Based on Network
Hi everyone,
This is something I've been playing with and I'd like to share it with you and get your thoughts.
The services I want to run at any given point depend on what network I'm attached to. For example, if I'm at home, I'll want avahi-daemon and cupsd started but I won't need iptables, since I'm behind my router's firewall. On the other hand if I'm at an internet cafe I need iptables but not the other two.
What I've done is set up a script in /etc/NetworkManager/dispatch.d which starts services based on the UUID of each connection (extracted from that connection's file in /etc/NetworkManager/system-connections.
I'm currently using the following script:
#!/bin/bash
IF=$1
STATUS=$2
function start_service {
for i in "$@"
do
if [ `/usr/bin/systemctl show "$i".service | grep -c "ActiveState=inactive"`=1 ]
then
/usr/bin/systemctl start "$i".service
fi
done
function stop_service {
for i in "$@"
do
if [ `/usr/bin/systemctl show "$i".service | grep -c "ActiveState=active"`=1 ]
then
/usr/bin/systemctl stop "$i".service
fi
done
if [ "$IF" = "wlan0" ] && [ "$STATUS" = "up" ]; then
UUID=`nmcli --nocheck -t --fields UUID con status`
case $UUID in
f5320fcd-43e2-4cc1-ba1a-9606f66b5332)
start_service avahi-daemon cupsd
logger "M5DKQ (home network) up"
5bfff3c5-c349-436b-953b-90de15c854d7)
start_service iptables
logger "EVO (4G hotspot) up"
40d74743-f809-41ce-821c-71f9f40b8513)
logger "GuestAccess (office guest network) up"
start_service iptables
logger "Starting cafe-specific services"
esac
fi
if [ "$IF" = "wlan0" ] && [ "$STATUS" = "down" ]; then
stop_service avahi-daemon cupsd iptables
logger "Stopped location-specific services"
logger "wlan0 down"
fi
Is there a better way to do this, like maybe a systemd custom target? Is there a cleaner way to script this?
Thanks in advance,
Hi Ranga,
The services dealing with SAP and database(Ex: Oracle in this case) are:
SAP<SID>_<Instance No.> (For ex: SAPECC_01)
SAPOsCol
Oracle<SID><No>Listener
OracleCSSservice
OracleService<SID>
Reward points if it is helpful##
Thanks & Regards,
Santhosh P
Please change the status to answered if you got the solution...
Message was edited by:
Santhosh Kumar P
Similar Messages
-
Does Golden Gate provide any Webservices to start and stop services?
Hi all,
We are trying to use GG in our application. But we need a way to start and stop services from java code.
Is there any Webservice interface or API to start and stop Golden gate services like GG manager, extract and replicat processes??
Thanks in advance for your help.
Yamini.You can control this at a database level using EVENTACTIONS parameter.
Create a table at source & target called "EVENT" with field EVENT_TYPE ( example names only - please call it what you like ) .
at Replicat config actions based on the data passed into the EVENT_TYPE column
MAP GG_ADM.EVENT TARGET GG_ADM.EVENT, &
FILTER ( (@STREQ(@IF(@COLTEST(EVENT_TYPE,PRESENT),EVENT_TYPE,"No EVENT"),"STOP") = 1)), &
EVENTACTIONS (IGNORE , LOG,STOP);
You'll need a seperate replicat to handle the start
MAP GG_ADM.EVENT TARGET GG_ADM.EVENT, &
FILTER ( (@STREQ(@IF(@COLTEST(EVENT_TYPE,PRESENT),EVENT_TYPE,"No EVENT"),"START_APP_02") = 1)), &
EVENTACTIONS ((SHELL (${GG_HOME}/diroby/start.ksh R1APP_02 )));
Hope that helps -
Batch file to start and stop services
I've setup a CF Probe on my Development Server to ensure my
CF Production server is up and running (services = Apache and CF
Application Server). It checks the PROD login page and if it times
out in 30 sec the probe fails. I understand I can execute a file
(batch file with net start and net stop) but the problem is I need
to have the probe somehow point to the .bat file on the PROD server
and not on the local machine. How can I remotely access this batch
file and execute it? I don't know how to point to the file on the
other server... can anyone help?Hi Ken,
You had pointed me in the right direction regarding the
psstools in order to create a batch file that can remotely start
and stop services.
i used the psexec command and am able to successfully restart
the services needed remotely... however when i pick the file in the
coldfusion administrator (in the probes section) how to i point to
the batch file to run? it seems like the probe is not running the
script like i want... the file is located on the c:\ so i entered
c:\test2.bat...
Thanks,
Matt
Matt,
You should review the online help in the cfadmin for probes
and the links it points you to in the developer's guide. Basically
you need to define a new probe in the cfadmin by clicking the
"Define New Probe" button. One of the probe's attributes will be
what action. Define the action as a program and point it at a batch
file running psexec. You will probably need to run CFMX as a
specific user and not as localsystem, which is the default. -
Starting and stopping services of SAP and database
pls tell what are the Starting and stopping services of SAP and database
Hi Ranga,
The services dealing with SAP and database(Ex: Oracle in this case) are:
SAP<SID>_<Instance No.> (For ex: SAPECC_01)
SAPOsCol
Oracle<SID><No>Listener
OracleCSSservice
OracleService<SID>
Reward points if it is helpful##
Thanks & Regards,
Santhosh P
Please change the status to answered if you got the solution...
Message was edited by:
Santhosh Kumar P -
EHPI not able to start and stop services shadowsystem
All,
I am working on an installation of EHP4 but am running in the following issue:
When I get to the phase SHDINST_OS the EHPI is not able to stop and start the service for the shadowsystem. The ehpi log gives:
Phase SHDINST_OS:
SAPehpi> Starting subprocess sapstartsrv.exe with id 7348 at 20100512081320
Environment: JAVA_HOME=C:\Program Files\Java\jdk1.5.0_19
Environment: PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Environment: Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;F:\usr\sap\HRS\SYS\exe\uc\NTAMD64;F:\usr\sap\HRS\SYS\exe\nuc\NTAMD64
Environment: auth_shadow_upgrade=0
Environment: dbs_mss_schema=hrs
Service not started.
Process with ID 8132 terminated with status -1
The EHPI gives:
An error occurred during the installation of the
SAP service SAPHRS_03:
Possibly the password for user .\SAPServiceHRS entered in phase
INITPUT was wrong. You can reset it by calling 'SAPehpi set stdpar'.
Try to execute SAPSTARTSRV.EXE manually using the following syntax:
G:\EHPI\abap\exe\sapstartsrv.exe -r
-p G:\EHPI\abap\HRS\SYS\profile\START_DVEBMGS03_NLDBHRS01 -s HRS -n 03
-U .\SAPServiceHRS -P <PASSWORD> -e NLDBHRS01\hrsadm
and check if the service SAPHRS_03 can be stopped and restarted.
When I follow up on the sapstartsrv first I can start/create it but that when I restart the EHPI it fails again on the same issue.
Anybody any ideas?
the passwords given in the EHPI are the ones of the SAPService user in the windows environment
ChrisHi
Have you tried below option as suggested in logs ?
> Possibly the password for user .\SAPServiceHRS entered in phase
> INITPUT was wrong. You can reset it by calling 'SAPehpi set stdpar'.
> Try to execute SAPSTARTSRV.EXE manually using the following syntax:
> G:\EHPI\abap\exe\sapstartsrv.exe -r
> -p G:\EHPI\abap\HRS\SYS\profile\START_DVEBMGS03_NLDBHRS01 -s HRS -n 03
> -U .\SAPServiceHRS -P <PASSWORD> -e NLDBHRS01\hrsadm
> and check if the service SAPHRS_03 can be stopped and restarted.
>
Thanks
Sunny -
Maxl Script to Start and Stop Service
Hi All,
to stop essbase service i had used below script in maxl but it did not work
alter system shudown;
is there any script that i want to stop Essbase services through MAXL ?
is there any script i want to start essbase services through MAXL?
ThanksIts as simple as this :
alter system kill request all;
alter system logout session all;
alter system unload application all ;
alter application 'App' disable connects;
Use all these when you are trying to Isolate the system from users .
But to answer your question Unload command is nothing but Stop , load is start ! -
I don't know if this can be done with VI Logger or need to use Labview V7.1.
After browsing through the VI Logger User Manual, it looks like the triggering that you are hoping to accomplish is possible. However, incrementing the filename for the next logging event is not going to be possible. VI Logger does exactly what its name tells - logs data. I don't think the automation that you are hoping to accomplish is possible.
For help with setting up your application, if you do choose to stay with VI Logger, make sure to chek out the Getting Started with VI Logger Manual.
Best of luck.
Jared A -
How to create services start and stop automation script for diff servers
Hi All,
i want to create a bat file for automation purpose to start and stop services
i have some services in 1st server aand some in 2nd server and some in 3rd servers.
has you all know i have to follow sequences to start and stop services can any help me in creating .bat by linking 3 servers fo starting and stoping services.
Thanks in advance
Regards
SMHi,
this is the list of start oder for services in 11.1.2.1 from the Installation and Configuration Guide
1. Databases for repositories.
2. Any corporate user directories that you plan to configure for use with Shared Services.
3. Foundation Services Managed Server application server, which includes Shared Services,
and EPM Workspace.
4. Reporting and Analysis Framework — Agent Service (if required for your environment)
5. Reporting and Analysis Framework Application Server (if required for your environment)
6. Web server
The remaining services and processes can be started in any order:
1. Performance Management Architect Services
2. Performance Management Architect application server
3. Performance Management Architect Data Synchronizer application server
4. Essbase Server
5. Administration Services application server
284 Starting and Stopping EPM System Products
6. Integration Services Server
7. Essbase Studio Server
8. Provider Services application server
9. Financial Reporting Services
10. Financial Reporting application server
11. Web Analysis application server
12. Calculation Manager application server
13. Planning application server and the Hyperion RMI Registry
14. Financial Management service
15. Financial Management Web application server
16. Strategic Finance service
17. Performance Scorecard application server
18. Performance Scorecard Alerter application server
19. Profitability and Cost Management application server
to start services on different servers you can use the sc command in your batch file
for eg
sc \\10.121.201.21 start HypS9FrameworkAgent -
Allow a user access to start and stop a particular service in Solaris 11 using RBAC controls
So, using svcbundle I created a service called "oracle" that starts and shutdown a db. I'm aware of how to grant RBAC access to be a "service operator" to be able to control start/stop ALL services. But I'd like to grant a user access to start and stop JUST this service.
in this document on page 15, it states that it's possible to do this kind of granularity but doesn't explain how to do it step by step.
how does one achieve this?
thanks.You need to add a property group such as
<property_group name='general' type='framework'>
<!-- to start stop oracle -->
<propval name='action_authorization' type='astring'
value='solaris.smf.manage.oracle' />
</property_group>
Then add the solaris.smf.manage.oracle authorization to the user profile.
As an example, see Less known Solaris features: RBAC and Privileges - Part 2: Role based access control - c0t0d0s0.org -
I am getting a service start and stop alert while doing the windows server updates.
HI
I am getting a service start and stop alert while doing the windows server updates. Services are wmiApSrv , WPDBusEnum. Can you please help me to under stand why i am getting the service start and stop alert.
Thanks & Regards
Abhilash K JoyHi,
The WMI Performance Adapter (wmiApSrv) service provides performance library information from Windows Management Instrumentation (WMI) providers to clients on the network. This service only runs when Performance Data Helper is activated.
This service is installed by default and its startup type is Manual. When started in the default configuration it will log on using the Local System account.
You can try troubleshooting the issue using Clean Boot to check if the issue is related to third-party software.
How to perform a clean boot in Windows
http://support.microsoft.com/kb/929135/en-us
Best Regards,
Mandy
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
Apple mobile device service started and stopped
my iPod touch cant be synced or even recognized on my iTunes and it says i gotta *start the apple mobile device service*.
i finally found it and it tells me that *"apple mobile device service started and stopped..."*
how can i fix it?
help!!!!Hello and Welcome to Apple Discussions.
Follow the instructions in this article:
http://docs.info.apple.com/article.html?artnum=307078
mrtotes -
How to start and stop the BI Services in Solaris 10
Hello All,
Can anyone guide me on how to start and stop the BI Services in Solaris 10. In windows there are options set in Start->Programs->Middleware_Home->Start/Stop BI Services.
Primarily after doing changes to the scheduler configuration, I need to restart the services to get it implemented? If yes how can I do it?
Any help will be appreciated
Thank you
Ash
Edited by: 902739 on Jan 11, 2012 12:17 PMPlease help me by showing action plan for stop sap , offline backup and then start sap.
i am little bit confuse How to start and stop SAP on cluster for offline backup
Below are the systems name with host name , please explain me in sequence
Systems name Hostname
# Hope SAP ERP Prod DB Primary gsgbbux860
# Hope SAP ERP Prod DB Standby gsgbbux861
# Hope SAP ERP Prod Cluster gsgbbux862
# Hope SAP ERP App 1 gsgbbux864
# Hope SAP ERP App 2 gsgbbux865
Thanks in advance
Zaheer -
Is there a way to Start and Stop OC4J through Services
Currently we are starting and stopping OC4J manually through the Dos command prompt on our servers. We are interested in making it a Services where we can start and stop OC4J thourgh the services option on the control panel in windows. Any suggestions would be greatly appriciated.
Thanks!
ChadThis has been discussed several times in this forum. One of the thread is
How can I set the export path in Form Builder 6i?
yes, you can use Windows Resource Kit or some third party freeware to do so.
regards
Debu -
Start and Stop Oracle BI services on UNIX box?
Hi All,
We have OBIEE installed on the Unix Servers and want to start and stop the Bi services.
What is the command to do so?user11001347 wrote:
Hi,
At the Unix prmompt I am executing the following command but it throws an error saying : run-sa.sh command not found,I am in the OracleBI\Set up Directory on the unix machine
-bash-3.00$run-sa.sh stop
does anyone has idea is that the exact command to I am missing anything?In what directory are you trying to execute that command? Do "pwd" to see where you are. You seem to need Unix training. In Unix (like in DOS) you can only execute a command/program that exists the PATH environment variable. Most likely the OBIEE bin directory won't be in the path, unless someone specifically added it. Further more the current directory (referred as ".") is not usually in the PATH variable either so when you execute commands you have to prefix them with the full path or with the current directory as Vinodh suggested. -
Start and Stop of Services for 11x
hi
Can anyone please let me know the order to stop and start the services of 11x (HSS,PLANNING,ESSBASE and BI)
Haven't found any documentation to in the portal related to start and stop of the services.
thanks in advance
Best regards
krishnatilakI take it you mean the order to start/stop services.
You can find the list at :- http://download.oracle.com/docs/cd/E12825_01/epm.111/epm_install/ch05s02.html
Cheers
John
http://john-goodwin.blogspot.com/
Maybe you are looking for
-
Please Help, I just bought my IPhone 4s and set up icloud account, however my mac is still on OS 10.4 and I saw a thread that indicated that new 4s owners on icloud can get a free copy of the Upgrade cd for os 10.5. I can't even find how to buy the c
-
'FND_SESSION_MGMT.ATTACH_SESSION' must be on enabling Passivation
The issue is related to Activation/Passivation. We have a AM which is based out of BI RTD Schema, which does not have supporting fusion state management schema like FND_SESSION_MGMT, FND_GLOBAL and PX_TXN related packages/procedures. But during appli
-
My safari keeps freezing and giving a rainbow spinning circle
Hi, I've had my Macbook Pro for about 5 months now. Just recently, I've been having issues with my Safari. Every once in a while, a spinning rainbow-colored wheel pops up and then the webpage freezes and loads nothing. I am looking for a solu
-
I start learning how to use javascript in xml for data retrieval, formatting and display. I had created "on click" button it never works. When I finish and run the script, it will show the button icon, but on clicking it, it will not activate and the
-
Unwanted DNS numbers listed - is my computer infected?
Hi, Since yesterday my internet browser is redirecting me to some websites I don't want to go to. I did some research on my computer and is listing 2 DNS numbers that are different to the one I used to have, and if I renew my DHCP lease sometimes it