Questions tagged [scripting]

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

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

Scripting is usually done in a scripting language. Such scripting languages are often dynamically typed and interpreted, as opposed to compiled languages. Examples of such languages include PowerShell, Perl and Bash.

1846 questions
27
votes
5 answers

Send bash -x output to logfile without interrupting standard output

Is there a way to send the information displayed by running a bash script with the -x option to a file, while not changing the standard output seen by a user running the script? This is a debugging feature I would like to implement in a bash script…
27
votes
3 answers

scp files and delete files on remote directory

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 scp files and delete files older than 5 days in the destination server. How do I…
Kapsh
  • 519
26
votes
4 answers

How to edit Local Group Policy with a script?

I have to set the local group policy settings and the the local security policy for a couple of machines which are not in a Windows domain. Until now, I've done that by manually setting the keys in gpedit. Due to the transition to Windows 10, I…
P. Egli
  • 361
26
votes
13 answers

How to encourage Windows administrators to pick up scripting?

When I worked as an administrator in my first job, I was frustrated that our administration processes with Windows servers were a series of point-and-clicks; we could never match the level of efficiency with the Unix servers which had a group of…
icelava
  • 890
26
votes
16 answers

Scripting alternatives to Bash shell scripts

I have just migrated to a UNIX workstation. My memory of Bash shell scripts has faded since school and I find the syntax to be highly confusing. I am wondering what other scripting languages are used to automate tasks. The two most popular ones that…
26
votes
13 answers

Need leading zero for batch script using %time% variable

I came across a bug in my DOS script that uses date and time data for file naming. The problem was I ended up with a gap because the time variable didn't automatically provide leading zero for hour < 10. So running> echo %time% gives back: '…
Ira
  • 363
25
votes
4 answers

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 server and brought my entire site down for an hour.…
ProgrammerGirl
  • 459
  • 1
  • 5
  • 8
23
votes
5 answers

Temporarily increasing sudo's timeout for the duration of an install script

I'm trying to write a script that will install a bunch of software and I'd like to not have to run everything as root , so I'd like to be able to prompt for a password and then go about the install, using sudo or su to get privileges when I need…
Arelius
  • 367
23
votes
5 answers

Scripted install of MySQL on Ubuntu

I need to write a script that will build my server from a fresh Ubuntu server install. Among things like Apache and PHP it needs to install MySQL. The only problem here is that when I install MySQL with apt-get, at some point the installation will…
Luke
  • 3,976
21
votes
7 answers

Setting the Timezone with an automated script

I'm writing scripts to automate setting up new slicehost installations. In a perfect world, after I started the script, it would just run, with no attention from me. I have succeeded, with one exception. How do I set the timezone, in a permanent…
Tom
  • 213
21
votes
8 answers

PowerShell prompt to continue execution of code

I have a script I am using to automate WSUS processes, and the last stage of it goes on to remove all old/unnecessary files/objects. I would like to prompt 'Press 'Enter' to continue with removal or any other key to stop' before the cleanup stage to…
Abraxas
  • 1,309
21
votes
5 answers

What version of Windows Management Framework is installed?

How do you check to see what version of Windows Management Framework (WMF) is installed? It seems like it should be a simple thing to find out, but I cannot. Even Googling a bunch of different versions of the question turns up little to nothing.…
Loduwijk
  • 595
  • 3
  • 5
  • 16
20
votes
1 answer

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. A standard way of doing this is to convert to ps…
plang
  • 325
20
votes
9 answers

script to automatically test if a web site is available

I'm a lone web developer with my own Centos VPS hosting a few small web sites for my clients. Today I discovered my httpd service had stopped (for no apparent reason - but that's another thread). I restarted it but now I need to find a way that I…
Xoundboy
  • 633
20
votes
6 answers

Find GUID of MSI Package

How can I find the GUID of an MSI package? I would like to script the removal of a program on a large number of desktops by using: msiexec.exe /x ProductCode Any reason why this would not work for any applications listed in "Add/Remove Programs?"
Sam Erde
  • 3,579