How to kill the process when the file is locked?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to kill the process when the file is locked?
# 8  
Old 10-01-2015
This is for a SAS 9.4 :
HOME=/opt/sas/9.4/SASFoundation/9.4/

You should have config files for share, if you dont
Go to $HOME/utilities/bin
If you dont have a directory called files create it with owner and group the appropriate SAS user
Create the followings files you need to modify according to what you want as shared libraries

create a .sas file e.g. start_share.sas
with in:
Code:
%let servername=sashrsrv;
options comamid=tcp;
libname geco '/data/mnt2/geco' ;
libname stil '/data/mnt1/stil' ;
libname fire '/data/mnt3/fire' ;
proc server id=&servername authenticate=optional;
run;

and a stop_share.sas file:
Code:
%let servername=sashrsrv;
options comamid=tcp;
proc operate server=&servername;
stop server;
quit;

Now you need to write a script to call those 2 files to start and stop SHARE:
e.g. here is for the start
Code:
HOME=/opt/sas/9.4/SASFoundation/9.4/utilities/bin/files
SASROOT=/opt/sas/9.4/SASFoundation/9.4
ConfigFile1=$HOME/start_share.sas
ConfigFile2=$HOME/stop_share.sas
LOGFILE1=/var/opt/sas/share/start_s94s.log
LOGFILE2=/var/opt/sas/share/stop_s94s.log

nohup $SASROOT/sas -sysin $ConfigFile1 -noterminal -logparm "write=immediate"\
       -log $LOGFILE1" >/var/opt/sas/log/rc.sas94share.log 2>&1
...

the stop command would be:
Code:
nohup $SASROOT/sas -sysin $ConfigFile2 -noterminal -unbuflog -log $LOGFILE2" \
        >>/var/opt/sas/log/rc.sas94share.log 2>&1

I let you adapt to your needs...
write a nice start/stop script you can put in the servers booting process ...

Last edited by vbe; 10-01-2015 at 09:57 AM.. Reason: corrections...
This User Gave Thanks to vbe For This Post:
# 9  
Old 10-06-2015
Could you please guide me for SAS 9.3?

In your reply, when should I run the start and stop script?
# 10  
Old 10-07-2015
for 9.3 its exactly the same... It depends how your SAS software was installed.. all SAS env has a SASROOT somewhere...
On what OS are you running?
Start/stop script are for boot time usually so you have to think of who is to run the process since that user can/will have to stop restart modify the configuration etc... so it should not be root and for the system boot you will need to do an su to that user:
Code:
(su $SASSHAREUSER -c "nohup $Program -sysin $ConfigFile1 -noterminal -logparm "write=immediate"\
       -log $LOGFILE1" >/var/opt/sas/log/rc.sas94share.log 2>&1 &)

We stop/start every evening:
Stop - and we stop SAS metadata servers too in order to cleanup all temporary storage ( using SAS cleanwork utility...) then restart all the other reason is SAS share logs grow enormously if you have a lot of activity, its a easy means to reset... and keep daily logs...
# 11  
Old 10-07-2015
I forgot to mention SAS will read /etc/services to look for the sasshare name you gave in the config file as above
Code:
%let servername=sashrsrv;

the to get the TCP port number
So in /etc/services you need a line:
Code:
sashrsrv        5520/tcp           # sas/share server

Choose a free port accordingly to your system... ( to modify /etc/services you normally must be root...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to report file size, pid and also kill the process

Hi All, Looking for a quick LINUX shell script which can continuously monitors the flle size, report the process which is creating a file greater than certain limit and also kill that process. Can someone please help me on this? (4 Replies)
Discussion started by: vasavimacherla
4 Replies

2. Shell Programming and Scripting

Soft kill a process to redirect the last kbytes output to a file

Hey guys, I have a python script that I call with this line: python mypythonscript.py >> results.csv &The problem is that the redirection from the stdout to the file results.csv only writes 4096 kbyte blocks. So if i kill this process with kill the last kbytes that the script produce will... (6 Replies)
Discussion started by: Mastaer
6 Replies

3. Proxy Server

Samba kill the locked files from a useraccount by multiple smbd pids

Details Samba server: Release: 5.10 Kernel architecture: sun4u Application architecture: sparc Hardware provider: Sun_Microsystems Kernel version: SunOS 5.10 Generic_142909-17 Samba version: Samba version 3.5.6 Smb.conf file section Global: # smb.conf for Airbus Industries fuer... (0 Replies)
Discussion started by: Jean-Guillaume
0 Replies

4. Shell Programming and Scripting

Kill an specific process ID using the KILL and GREP commands

Good afternoon I need to KILL a process in a single command sentence, for example: kill -9 `ps -aef | grep 'CAL255.4ge' | grep -v grep | awk '{print $2}'` That sentence Kills the process ID corresponding to the program CAL255.4ge. However it is possible that the same program... (6 Replies)
Discussion started by: enriquegm82
6 Replies

5. Shell Programming and Scripting

kill process from a file or directly with top

i have edited a script to kill an exact mysql process is causing the high load on the server, my problem is, kill dont kill it! script: #!/bin/sh top -n 1 -u mysql | grep mysqld | awk '{print $1}' > pid proc='cat pid' kill -9 $proc or i try with kill -9 `top -n 1 -u mysql | grep mysqld... (8 Replies)
Discussion started by: chandro
8 Replies

6. Shell Programming and Scripting

Kill a process without using kill command

Sorry, posted the question in other forum. (0 Replies)
Discussion started by: sudhamacs
0 Replies

7. Programming

kill(0,-9) don't kill the process

Hi all i have simple c program , when i wish to kill the app im using kill(0,-9) , but it seams this command don't do any thing and the program. just ignore it . what im doing wrong here ? im using HP-UX ia64 Thanks (9 Replies)
Discussion started by: umen
9 Replies

8. UNIX for Advanced & Expert Users

When kill doesnt work, how to kill a process ?

Hi All, I am unable to kill a process using kill command. I am using HP-UX system. I have tried with kill -9 and i have root privilages. How can i terminate this daemon ? ? ? Regards, Vijay Hegde (3 Replies)
Discussion started by: VijayHegde
3 Replies

9. Shell Programming and Scripting

how to kill process from file

i have a script that read a file which contains process_id and time that he's in and it lookes like this 0:30 54545 0:44 66788 0:90 23233 i need to read every line in the file and get the time and if the process is greater then 0:30 to kill the process id the script looks like... (17 Replies)
Discussion started by: naamas03
17 Replies

10. Post Here to Contact Site Administrators and Moderators

how to kill process from file

hello i want to write a script in unix which read file that contains : hour and process_id like this file bbb: 0:30 6678 1:40 8789 and for every line he check if the hour greater then 30 minutes he kill the process_id the script looks like this cat bbb | while read line do ... (1 Reply)
Discussion started by: naamas03
1 Replies
Login or Register to Ask a Question