Hi,
I want to create a DOS Batch file:
1. That login on 100 sun solaris/Unix servers.
2. search syslog.0, syslog.1, syslog.2…n so on
3. Then remove them.
To use RM command i have to login with SU.
Please help me to create that script.
I have already used a login script
@echo off
c:\Plink.exe -ssh -l xyz 192.168.1.155 -pw “123456” -m input.txt >> result.txt
but i can not remove those file because to remove i have to login with “su”.
and “su” can not login remotely.
i also unable to use sudo, because ask for password, I i dont know how to enter password in sudo script.
Please help
One error in my above post. The cron or task scheduler command should be
You should not have the word script in that command.
startouch1:
I assume you are the administrator and
since you have to do this on 100 servers,
every day, you would rather automate ?
Let’s build a solution for you step-by-step.
1. The solaris shell command to remove all
syslog.* files is
2. To remove syslog files, you will need
to be superuser. You can NOT login as su
remotely, but you can supply
the supreuser password using a HERE DOCUMENT.
So, the solaris script is
3. If you put the above script in your DOS file
input.txt, and call the plink command as follows,
it will automate this for one server.
c:\Plink.exe -ssh -l xyz 192.168.1.155 -pw “123456” -m input.txt >> result.txt
4. You now want to automate for
100 solaris servers (I assume that means
a lot of solaris servers).
Create a file C:/ServerList.txt as follows.
\t is tab.
First field is IP address of the solaris server,
second remote login,
third remote password,
fourth superuser password.
Each server entry – one per line.
5. Let’s now write a biterscripting
( http://www.biterscripting.com )
script to automate this for all Solaris servers
using the input from file C:/ServerList.txt.
6. Save this script in file
C:/Scripts/SolarisLogs.txt on your local
DOS system, from where you will kick off
this activity. You can now run this script
manually from biterscripting with this command.
7. Of course, you do not want to
run this manually every day. So,
schedule this script to run at a time daily
when the servers are least in use,
using cron or task scheduler,
with the following command.
That completes the solition. It was a good
challenge. I have not tested it. You may need
to do some trial-and-error during testing.
But I hope that this, at least, provides a
good starting point.
And yes, if you improve upon this solution,
you should re-post it for the benefit of
other over-worked Solaris administrators.