A form of computer programming that — in the context of system administration — lends it self well to automating tasks.

learn more… | top users | synonyms (2)

3
votes
2answers
404 views

How can I check for a string match AND an empty file in the same if/then bash script statement?

I'm writing a simple bash script to do the following: 1) Check two files (foo1 and foo2). 2) If foo1 is different from foo2 and foo1 NOT blank, send an email. 3) If foo1 is the same as foo2... ...
3
votes
4answers
6k views

How to Automatically and Temporarily block an IP address making too many hits on the Server in a short timespan?

One of my LAMP servers was recently brought down by some kind of script bot looking for exploits. From the looks of it, it was making so many requests a second, that it overloaded the RAM on the ...
3
votes
3answers
796 views

how to rename a remote file on linux with script

I would like to have a (bash) script to rename a file on multiple remote linux servers any idea how to do it? thanks.
3
votes
3answers
4k views

scp files and delete files on remote directory [closed]

I am a unix noob, so please be patient :-) I have a script that scps a bunch of files to another server. Suppose they are z1.foo, z2.foo etc. What I want to do is to overwrite the files at the ...
3
votes
3answers
558 views

Write shell script that can only be run by a sudo user in Ubuntu

I'm writing a shell script that is supposed to be run by users only in sudo user list, what's the appropriate way of doing this? what I'm thinking is in the shell script, try to create a dummy file ...
3
votes
1answer
881 views

How can I start multiple programs simultaneously?

I have 4 programs that I'd like to start by using only 1 script or shortcut. How can I achieve this? Is Powershell able to do that? I tried to do it using a .bat file but the script pauses until the ...
3
votes
1answer
167 views

“Threading” in Shell Scripts

I have a situation where I need to: Do some preamble setup in Script A Start Scripts B, C, D and E together, so they run concurrently When all four scripts have exited, do some cleanup in Script A ...
3
votes
3answers
93 views

Update a network driver through GPO/AD

Our organization has just deployed new computers with Windows 8.1. Roughly 50 of them. We've run into an issue with the driver on the new computers which is flooding the network with ipv6/multicast ...
3
votes
1answer
53 views

Getting WINS Server Statistics

I know WINS is ancient. No need to remind me. For what it's worth, this effort is going toward a project to retire it from the environment altogether. But before I can do that - I need to be able to ...
3
votes
8answers
525 views

How best to monitor and alert on the absence of an event in the logs?

With logs getting captured in syslog-ng, I'd like to be able to automatically monitor the logs and receive an alert if NO log events appear that match a certain criteria. For instance, for a ...
3
votes
1answer
320 views

Powershell and NMAP Information Sharing

I am working on a project where I would like to perform host documentation for a variety of items. Part of these items would be sourced from Powershell and the rest would be sourced from NMAP. For ...
3
votes
3answers
608 views

Email to run a bash script

I have a bash script to restart a service that runs every 3am to guarantee that the service isn't crashed when users require it. However, I need to provide a simpler way for my partner (that isn't ...
3
votes
1answer
179 views

Why start script with /usr/bin/env python

I just downloaded a python script and noticed that the "shebang" line at the top looks like: #!/usr/bin/env python instead of the familiar #!/usr/bin/python What's the reason for that?
3
votes
2answers
4k views

Can the Linux ps command output be filtered by user AND command?

I need the pid for a process given its owner and its command. I can filter a process per user with "ps -u xxx" and its command by "ps -C yyy", but when I try "ps -u xxx -C yyy", they are combined ...
3
votes
2answers
288 views

Linux script to identify security issues & generate report

I've previously used a great script on a Linux servers to report on all sorts of security issues. It generates a comprehensive list of potential security flaws on the machine including: out of ...
3
votes
1answer
296 views

Force Close a file not a process

I want to write a script that forces closed a specific file and then copies it from one server to another. To manually do this I would use Administrative Tools --> Computer Management --> Shared ...
3
votes
1answer
762 views

Amazon EC2 notifying the instance when the autoscale service terminates it

I am in need of knowing when an instance is supposed to be shutdown by the autoscale, as I want the instances to register themselves and deregister themselves from a given service. I know that the ...
3
votes
2answers
3k views

Install .msi from script, detect when install is done

I'm trying to make an install script. I want to install an .msi file, Python, and then install other things after Python is installed. I already see how to do a command-line install. However, msiexec ...
3
votes
4answers
313 views

Good shell scripting guide

I have the Orielly's "Learning bash". I also refer to Advanced Bash-Scripting Guide(tldp.org/LDP/abs ). Any other good books on the subject ?
3
votes
1answer
483 views

IIS 6 Logging on a webfarm

Is there away in IIS 6 to programmaticly turn on/off logging in a web farm. we have 10 servers and I don't want to when needed log on to each and flip logging on, and then when we are done login and ...
3
votes
1answer
91 views

Change shortcut arguments via script

We have a program here that requires every user to have a shortcut on their desktop that points to an ini file. Each file is unique to the user. Recently, we've done a new install of the application ...
3
votes
2answers
707 views

Backup script to FTP with timed subfolders

I want to make a backup script, that makes a .tar.gz of a folder I define, say fx /root/tekkit/world This .tar.gz file should then be uploaded to a FTP server, named by the time it was uploaded, ...
3
votes
6answers
1k views

Windows XP autostart process as administrator

I am looking for a way with which i can autostart a certain program on logon of a user with user-rights with administrator-rights. I already tried using task scheduler but it didn't work out because ...
3
votes
1answer
1k views

Verify who has Bitlocker key backed up via PowerShell?

We currently use Bitlocker on our laptops here at work. The helpdesk are responsible for backing the Bitlocker key up to AD when they build the system. We ran into an issue recently where a user had ...
3
votes
1answer
229 views

Rsync: General file/folder synchronization

I have a file server, which is in-charge of pulling a folder tree from multiple workstations on a daily basis. My current method for this is by using rsync, (which works pretty well provided directory ...
3
votes
1answer
141 views

Test file for specific permissions

I have a script where I'd like to test a file for specific permissions, specifically 0644, if it is not that then chmod it. I know I could just chmod it and let it fall through in case it already was ...
3
votes
1answer
813 views

How to create a Windows 2008 Advanced Firewall rules group definition through the command prompt

Is there a way to create a group, or add to an existing group, to a rule in Windows Advanced Firewall (preferable through a command prompt or WSH script). Edit:
3
votes
3answers
2k views

How do quotes/strings work in Powershell?

I'm have a command line that works in the regular old Windows Command Shell, but somehow gets misinterpreted in Powershell (I'm fairly new to Powershell). sqlcmd -S .\SQLEXPRESS -i ...
3
votes
2answers
1k views

Run command before and after printing with CUPS?

this is a home setup. A central printer server (Linux) manages the queue, a HP 2430DTN is attached to it via 100Mbit/sec Ethernet. The printer is hooked up to a managable power source. A shell script ...
3
votes
2answers
1k views

Why is `slapconfig -backupdb` not creating disk image when run from cron on Snow Leopard Server?

Years ago I put together the following expect script to perform Open Directory backups under Tiger Server and it's worked well under Leopard Server as well: #!/usr/bin/expect -f set date [timestamp ...
3
votes
4answers
3k views

Secure method of changing a user's password via Python script/non-interactively

Questions Is there a more secure/better way for setting a user's password non-interactively via a Python script? My current solution uses chpasswd from a Fabric script. Another option would be to ...
3
votes
2answers
394 views

How can I know when a Xen VM has started when starting using CLI

I'm using XenServer as a host for disposable QA machines for our application development. I'd like to write a script that automatically creates a new VM from a template, starts it, logs into it, ...
3
votes
2answers
219 views

What are the most prefered languages for writing a login script? Why?

I am in the process of building a new windows domain (migration from Novell) and need to write a login script to map network drives/printers. In the past I have used vbscript mixed in with a little ...
3
votes
2answers
475 views

Remove all recurring meetings scheduled by terminated user

I am looking for a way to efficiently and effectively remove all meetings that a terminated user may have created during their tenure. Currently, our group has to grant admin access to the user's ...
3
votes
1answer
289 views

Powershell script for setting password expiry

Due to mistakes by the helpdesk staff, I found that over a 100 user accounts in my company AD have been set so that their passwords never expire. To avoid the situation in which all these users ...
3
votes
2answers
716 views

Nginx & Lua: Hacks, optimizations & observations

Following this post on using Lua to increase nginx’s flexibility and in reducing load on the web stack I am curious to know how people are using Lua to enhance nginx’s capability. Are there any ...
3
votes
1answer
1k views

How can I use SetUID on a shell script to run as a non-root user?

Our company's server is running Ubuntu 12.04 (Precise) and Apache 2. We have a custom, internal web application installed. I have a bash script which pulls any updates to that app from source control ...
3
votes
2answers
382 views

Ubuntu: How to set up an init script that only runs on the first boot?

I need to install an init script that only runs on the first boot after it's installation. How can I accomplish that on Ubuntu?
3
votes
2answers
335 views

Programmatic, script-based, or command line method to change starting program for user on Windows Server 2000/2003?

I have written an app that we want to distribute to a large number of customers to be used as the shell program when they log onto their server with a particular admin account. I have figured out how ...
3
votes
4answers
334 views

Prevent sudo, apt-get, etc. from swallowing pasted input to STDIN?

I often write up wiki instructions to install various server packages on Ubuntu (11.10 Oneiric at the moment). They always involve things like: sudo apt-get install -y postfix sudo cp ...
3
votes
3answers
3k views

Test for existence of an AD object in PowerShell using only Microsoft-provided cmdlets

I want to test for the existence of a computer account in Active Directory with PowerShell using only tools from Microsoft. Using Quest AD cmdlets, I can do this: if (!(get-qadcomputer $name)){ ...
3
votes
2answers
106 views

Is there a program to batch-configure Windows settings?

I was about to write a quick script/program to configure Windows, but thought I would check before I spent a few hours coding. I'm looking to configure things like power settings adding domain ...
3
votes
3answers
1k views

How do I mount an Exchange mail store from the Windows Command Line?

Our Exchange server is running Exchange Server 2003 Standard on the Windows Server 2003 platform. We're dealing with the mail store size issue, where if the mail store goes over the limit, it gets ...
3
votes
1answer
3k views

How to automatically make a change to Outlook Microsoft Exchange Proxy Settings

I need to make a change on all computers in our domain. Specifically I need to make a change to the Microsoft Exchange Proxy Settings. Our users have Outlook 2010 installed. These setting can be ...
3
votes
2answers
1k views

Script shutdown a computer with gpo

Hello everybody I have windows server 2003 domain and windows xp workstation. it is necessary that at 6.00 pm on computer was displayed a window (Do you really want to shutdown a computer and Yes/no ...
3
votes
2answers
12k views

username and password for rsync in script

I'm creating a cron job to keep two dirs in sync. I'm using rsync. I'm running an rsync daemon. I read the manual and it says: RSYNC_PASSWORD Setting RSYNC_PASSWORD to the required ...
3
votes
8answers
578 views

Portable scripting language for a multi-server admin?

Please Note: Portable as in portableapps.com, not the traditional definition. Originally posted on stackoverflow.com, asking here at another user's suggestion. I'm a DBA and sysadmin, mostly for ...
3
votes
4answers
3k views

Disable a specific ethernet card via batch commands on Windows

What I would like to do is disable a NIC based on the connection name (aka: what you see in the "network connections" window, or what you would use with netsh commands). I know enabling/disabling can ...
3
votes
1answer
2k views

How to add an Open Directory server via a script?

What is the best method to add an Open Directory server via a shell script on a brandly new imaged computer? I've created a new image with InstaDMG and I'd like to add the Open Directory Server via a ...
3
votes
2answers
1k views

Can I “register” python scripts to execute on Windows?

I have Python 2.5 installed on Windows XP and a collection of scripts available in a certain directory. According to this article by Amanda Birmingham I can setup up a path for the Python executable ...