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)

1
vote
2answers
1k views

Sending email after successful mysqldump

I've a script which will take backup of mysql db through mysqldump. I'd like add another option in this script to send an automatic email if the dump is successful or failure. Here's the script: ...
0
votes
2answers
39 views

Windows: change own password of standard user by using commandline

I want to change the password of the current logged in Windows user (no Active Directory) in a scriptable way. The users have the right to change their own passwords and already can change the ...
15
votes
5answers
12k views

Bash Scripting: Require script to be run as root (or with sudo)

I'm trying to write a bash script (in Ubuntu) that will backup a directory using tar. How can I do a check in the script so that it can only be run as root (or with sudo)? For instance, if a user ...
-1
votes
1answer
32 views

Delete files by date and character count

I have an interesting problem. I need to delete directories that are older than x days but are only numerical. We have a log folder that has log files that we need to delete but other files and ...
-2
votes
0answers
17 views

Script to bulk import groups and contacts for Lync2013 [on hold]

Does anyone have a script out there that will allow me as the administrator for our Lync 2013 Server to administer the groups and contact lists in Lync 2013? I have seen Contact Manager for Lync by a ...
2
votes
4answers
1k views

Get maximum memory usage of linux executable

I need a shell script which will retrieve the maximum memory consumption of a linux executable. The executable may spawn child processes using significant amounts of RAM which should be included in ...
0
votes
1answer
47 views

Programatically Pull Account Track Data from Konica Minolta/Ricoh Copy Machines

To be safe, I checked the serverfault guidelines, and I think this question falls under management of 3rd party platforms or administration of networks. I'm sure I'm not the only sysadmin with this ...
2
votes
1answer
2k views

Windows Server 2008 x86 Services for Unix SDK (SUA) RSH

Running RSH commands on a Windows box against a Linux box works only for the administrator user. Is there a file somewhere that has a list of users that can run commands remotely? More Info The ...
-2
votes
1answer
25 views

Script to open a webpage or at least hit a web api [closed]

I need to write some kind of script that runs on a windows server that can be scheduled to run throughout a day to open a webpage to a specific address or at least hit an HTTP api it doesn't ...
2
votes
3answers
7k views

Add user account to local Administrator group on multiple Windows Server 2008 machines

I have a number of servers to which I need to grant administrative access to 1 particular user, i.e. add him to local admins. I guess it can be scripted with PowerShell or somehow else.. Can somebody ...
4
votes
3answers
3k views

Is it possible to use Puppet to ensure multiple files in a directory are present without defining all of them?

I have a couple hundred one-off servers that have different configuration files that need to be present in a directory. Copies of the files reside on the puppet master. Within one of my classes I ...
-1
votes
1answer
28 views

Centos running if - then command with multiple allowed values

Is there a way to run a if command in a script that can match multiple values for example I would push a script to a bunch of servers and each server would only run the command if the servers host ...
0
votes
1answer
14 views

Logrotate executes postrotate even if file not rotated

I have a problem with my rsyslog and imfile that fails when one of my log file gets truncated.. So to workaround the problem I have modified the logrotate script as follow: ...
-2
votes
0answers
27 views

Move folder with current date name to another location? [closed]

I create a powershell script that create a folder with the current date in the following format ddMMyyyy, Rename-Item -Path "\shared folder\folder_to_rename" ("\shared folder{0:dd-MM-yyyy}" -f ...
1
vote
2answers
69 views

Loop in a Windows batch file

I have a problem where I need to clone one virtual machine into several machines for production. The machines have names that is assigned by variables and a rdp port is also assigned by a variable. ...
6
votes
1answer
426 views

Bash script parameters

I need to write a bash script, and would like it to parse unordered parameters of the format: scriptname --param1 <string> --param2 <string> --param3 <date> Is there a simple way ...
1
vote
0answers
25 views

Parsing part of a file name to use as a variable in bash [migrated]

I need to get the DB name and use it as a variable from part of a file name. Currently I have it pulling in the name of the file from a ls command. This is what it returns: Test-20150311-1200.sql I ...
0
votes
0answers
25 views

Powershell - Printer settings not applying

I'm currently trying to script settings for a printer connected through a local network, a normal TCP/IP-printer setup if you will. Since I'm on my phone I don't have access to the code right now, ...
-1
votes
4answers
148 views

How to test if two given files are identical?

Just updated the code... I get out everytime on the "else" sequence. You can download the update.sh file from my server. it only contains echo "Hallo update" Updated code (03.11.2015) ...
0
votes
0answers
38 views

Is shell parent of all the processes in linux [migrated]

I have been trying to understand shell scopes and environment in depth. I have been reading about how if we do export VARIABLE=VALUE it will be available in subshell. So I wanted to ask a question I ...
1
vote
1answer
68 views

Transfer files via Powershell Remoting (like scp in linux)

During the creation of a few powershell-based deployment scripts, I sorely missed an easy way to quickly transfer a file to another server (over the internet) via Powershell Remoting, something like ...
3
votes
1answer
83 views

How can I have Linux execute a bash script when a specific disk is hotswapped in?

I have a set of hard drives which are rotated for offsite backup. There are several steps that need to be performed when one of the disks is reinserted which I've rolled into a simple bash script. ...
1
vote
1answer
1k views

Accessing Workgroup Shared Folder from Domain

I have a domain and a workgroup. My users are supposed to upload files on regular basis to several shared folders on the workgroup. I have difficulty accessing the workgroup shared folders without ...
0
votes
1answer
39 views

Trouble with embedding html email with PowerCLI/Powershell for gmail

I am new to Powershell, I am a junior admin for a VMware environment. I am trying to automate a weekly report for snapshots in PowerCli. I am making the script in Powershell. I have made a simple ...
14
votes
3answers
9k views

What is needed for a linux service to be supported by chkconfig?

I am trying to add to the auto start at boottime a linux service through the chkconfig -add <servicename> and I get a message saying service <servicename> does not support chkconfig ...
1
vote
1answer
25 views

How to get value of environment variable from passed command line parameter

I have to use/reference an environment variable value which will be passed as a command line argument. Something like below set myvar=%1 echo Value of %myvar% is %%myvar%% Here in %%myvar%% I want ...
5
votes
2answers
2k views

Changing physical path on IIS through appcmd isn't activated

We have come across an issue on IIS 7.5 where we have a simple deploy system which consists of the following: Create a zip-file of new webroot, consisting of three folders: Api Site Manager This ...
240
votes
11answers
288k views

How to determine if a bash variable is empty?

What is the best way to determine if a variable in bash contains ""? I have heard it recommended that I do if [ "x$variable" = "x" ] Is that the correct way? (there must be something more ...
1
vote
1answer
47 views

How to make a simple script that increases a number character by 1

I have to add a single command for MANY vlans, and wondering if I can generate a simple text file somehow? Then I can simply paste the text file into the network switch and it will add the needed ...
6
votes
4answers
7k views

How to parse and convert ini file into bash array variables?

I'm trying to convert an ini file into bash array variables. The sample ini is as below: [foobar] session=foo path=/some/path [barfoo] session=bar path=/some/path so these become: ...
2
votes
1answer
74 views

How do I prevent Apache2 from trying to execute a file as a script?

So basically, I followed this guide about iptraf monitoring and rrdtool to the letter. I put it in /usr/lib/cgi-bin/ as usual for cgi scripts. Then, when I visit it from a browser, the images it makes ...
19
votes
8answers
7k views

Is there any reason to use bash over zsh? [closed]

I'm curious about why one would want to run bash instead of zsh. I mean zsh is fully backwards-compatible with bash. Don't get me wrong: I don't dislike bash or anything. I just genuinely want to ...
0
votes
1answer
1k views

How do I delete a remote file using NCFTP (Windows client)?

With ncftpput.exe how do I delete a remote file once logged in? I have tried using the -W option to send a Raw FTP command but cannot get it to work. Has anyone got a working example? Have tried ...
2
votes
2answers
5k views

Powershell script to delete sub folders and files if creation date is >7 days but maintain parent folders of sub folders and files <7 days old

I'm currently using the Powershell script below to delete all files directories and sub directories of "$dump_path" that are seven days or older based upon the creation date and not modified date. ...
2
votes
1answer
105 views

Joining 150 computers to Active Directory

I am a junior system IT administrator. We have Windows server 2008 R2 standard and 150 computers with Windows 7 professional (32 bit). We have installed an Active Directory domain on the server and we ...
0
votes
0answers
30 views

Collecting PC to Printer relationship information across an entire domain using a script

I'm trying to create a script which will enable view every PC to Printer relationship across an entire domain of around 1200 machines. In theory I am looking for a script to be run so that it will ...
1
vote
0answers
177 views

Openvpn-server: Execute a script when on a failed connection?

Good morning, I was wondering if It was possible to setup something to execute a script when someone tried to connect but the TLS check failed (When someone who is not supposed to connected try to° ...
2
votes
3answers
3k views

Use GRUB/GRUB2 to PXE boot OS image

Asked this in stackoverflow but they recommended I post this here: Here is the situation I am in: I currently have a Windows drive that boots XP. The BIOS does not support PXE booting so this is out ...
4
votes
6answers
26k views
0
votes
1answer
88 views

Complex retention policy

I have daily database backups scp'd to a directory on a local linux machine for multiple databases. The naming format is [dbname].backup; there is no timestamp and currently the latest backup ...
2
votes
1answer
2k views

How to set a timeout within a BASH script for a process that sometimes becomes inactive?

I have a bash script that runs a lot of commands/tools like convert or pdftk via CRON. It happens quite often that e.g. pdftk becomes "stale" or "hangs" and the calling script stops proceeding. Is ...
12
votes
4answers
18k views

Multi-select menu in bash script

I'm a bash newbie but I would like to create a script in which I'd like to allow the user to select multiple options from a list of options. Essentially what I would like is something similar to the ...
2
votes
3answers
2k views

Is there a command line equivalent of Sigverif.exe?

The windows XP sigverif tool is useful for identifying non-signed executables, but does not seem to be amenable to scripting -- is there a command line equivalent?
18
votes
1answer
1k views

Shell command slow when using pipe, fast with intermediate file

Does anyone understand this huge difference in processing time, when using an intermediate file, or when using a pipe? I'm converting tiff to pdf using standard tools on a fresh debian squeeze server. ...
1
vote
1answer
46 views

Puppet: How to write a proper “condition and condition” statement?

I wrote a "Message of the day" Puppet module which affects all proxy servers in my company. Within the template file, I have the following "if statement": <% if @hostname !~ /^haproxy\d+/ and ...
1
vote
3answers
209 views

How Do I Automatically Update My Database Nightly

Currently, every day before I start work, I complete the following procedure: ssh to the production server gzip our daily database dump file scp the gzipped dump file over to my computer gunzip the ...
-2
votes
1answer
190 views

How to automate a java service to start if server restarts

I normally run my java service on CentOS box using nohup like below: nohup java -jar myapp-0.0.1-SNAPSHOT.jar server my-configure.yml > outfile & However, if the server restarts the service ...
0
votes
5answers
1k views

Which characters if cat'd will mess up my terminal and make a ton of noise?

I've written a wrapper script that I alias to cat, called safecat, that protects me from accidentally cating binaries and getting a ton of screeching from my PC speaker. Right now it considers a file ...
1
vote
2answers
61 views

How to import or export nagios host Data from command line

This might be a basic question for some of you but being a beginner i wanted to know how to export or import data of the current status(CPU, Memory, Diskspace etc) of the host from command line into a ...
0
votes
1answer
76 views

Turning off specific Icinga 2 notifications over HTTP

In Nagios Core, it is possible to turn off notifications for a specific service or host through the web interface. This is a simple web request, which we can also construct in a command line ...