Questions tagged [scripting]
A form of computer programming that — in the context of system administration — lends it self well to automating tasks.
1,836
questions
0
votes
3
answers
2k
views
init.d tomcat6 script
I "installed" tomcat on ubuntu by just unzipping it. Is there a standard script I can use for /etc/init.d/tomcat? Or do I need to create one?
Currently I have created one that works, but I didn't ...
0
votes
1
answer
1k
views
Running a script at Windows 7 or 2008 shutdown
Is there any way to run script before the computer running Windows 7 or 2008 shuts down without using local group policy editor or domain based policy? Regedit tool should be OK if possible.
0
votes
3
answers
7k
views
Batch File Syntax to get files from FTP server
I have trouble getting all files from an FTP Server. Usually I get all files using the command line/terminal with syntax the following syntax: get a.txt (very, very time wasting with login ...
0
votes
2
answers
3k
views
What are the best practices to manage UPS in windows 2008 R2?
with win2k3 i used the ups service to monitor usb connected UPS and launch scripts when ups meets critical battery condition.
The ups service is no more available in win2k8 and power management seems ...
0
votes
2
answers
2k
views
mkdir: cannot create directory `../abc/2011-11-23: No such file or directory
I have got a sftp script that downloads the archives , unzip it and then rename the files according to date and moves it to respective folder.
I had to move the script from USB drive onto a separate ...
0
votes
1
answer
823
views
Query Exchange 2007 remotely for a user(s) mailbox size, and quota
Currently I'm using this powershell command on the server in the Exchange Management Shell:
Get-MailboxStatistics username | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –...
0
votes
2
answers
82
views
How to get linux start a script when files did changed
i'm not that good configuring a linux server. So i hope someone can give me a hint for my problem.
I have installed trac for managing projects. It contains a plugin for doxygen. As far as i know i ...
0
votes
1
answer
6k
views
How can I send cc: using Bmail.exe
We use bmail.exe for a lot of automated work and sometimes we'd like to use a cc:
but the app doesn't provide an input parameter for one.
However it does allow you to set the body and subject so is ...
0
votes
3
answers
179
views
listing file with for loop using array and if
I've written a script to check files in different directories and want this script to show me error in case a file does not exists. But It show me Both ERROR and NO ERROR due to loop. ow to adjust so ...
0
votes
2
answers
288
views
Discovering proxy servers
I work at a datacenter and work on servers in various global locations. We have about 10 proxy servers and no good way to know which proxy server to use on which server/domain/vlan ect... Don't ask ...
0
votes
2
answers
645
views
Best 'free' option for alert notifications other than email/SMS
Looking for a Linux script solution that can send alerts to a service such as Twitter, Skype or Google Talk and sends to Android and iPhone clients.
Have found twurl for Twitter with previous Bash ...
0
votes
3
answers
703
views
execute script when a hardware is plugged in
How can I tell my Ubuntu installation to execute some scripts when I connect a specific hardware?
For example: I have an external eSATA disk. When this (and only this) disk is plugged in, my notebook ...
0
votes
6
answers
2k
views
Automate switch user in script
I have to write a script on ubuntu and some commands require root privileges. The script is full of normal linux commands. Is it possible to write a switch user(su) script that automates the password ...
0
votes
4
answers
667
views
Encrypting shell script
We have a few shell scripts for backup/database dump purpose which have username/password info in them. Is there any way do this other than SHC which appears to be having some issues.
0
votes
4
answers
117
views
Allowing an user to execute just something
which is the best way to allow a new user that I just created on ubuntu linux 9.04 to execute a script that requires some sudo without allowing him to the sudoers?
The fact is that I want to give the ...
0
votes
3
answers
648
views
Making Python scripts more user friendly?
I have a bunch of python scripts I've put together that cut down on busy work, but I'd like to be able to share them in an easier-to-use format for others to be used internally. The scripts aren't ...
0
votes
2
answers
1k
views
How can I run a shell script upon system shutdown in a Knoppix Live system?
I want to run a shell script upon system shutdown in Knoppix Live (which runs from a writable USB flash drive) so that I can backup some data and ftp it to a remote server. The script works fine but I'...
0
votes
4
answers
115
views
Extracting the last section of a log file
How can I extract all the contents of a file which comes after a given line ? The line can be matched by exact contents or regular expression.
0
votes
2
answers
2k
views
function is not working when used in a script file..showing error command not found
I am using rhel 5. I am learning shell-scripting.I created a function named
vi /etc/bashrc (so that i can use this function even after logout)
currenttime()
{
echo -e "Current time is `date`";
...
0
votes
2
answers
70
views
Submitting Large file of MySQL commands
I have a large file of MySQL insert statements that I need to submit to a database.
Normally I would just "cat $FILE|mysql -u$USER -p$PASS database".
The problem is, that the file occasionally has ...
0
votes
2
answers
4k
views
Checking file properties in a batch script?
I have a batch file from a vendor to patch some software on a Vista machine. I'm going to be using GPO to push it out as a startup script.
My problem is some systems require this software and some ...
0
votes
2
answers
505
views
Post-startup & Pre-Login shutdown
Is there a way [using a batch file] that I can set a system to shutdown PRE-login
but POST-startup? I've tried a scheduled task to run this batch file with the
"/SC ONSTART" flag .. That didn't work. ...
0
votes
1
answer
764
views
Quick way to duplicate zones in BIND
We have a standard high-availability setup at a co-location facility that we host client programs on. For some programs, we host the DNS, but I find that setting up multiple zones manually can be ...
0
votes
4
answers
29k
views
Command Line Winrar & Batch Scripts
I've written a wee batch script to backup some stuff on my desktop and dump it
over the network to a share... The only thing that's bugging me is the verbosity
of rar.exe while it's doing the ...
0
votes
2
answers
1k
views
temp folder in Macos under root?
I'm eriting a MacOS script that need to run under admin rights (under 'sudo'). Script needs a temp folder in order to keep some temp files. Unfortunately, there is no 'TMPDIR' under root! If i run '...
0
votes
3
answers
290
views
Shell script capturing values from output of command
From a shell script, I run a ping command:
ping -c4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=34.2 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=58 ...
0
votes
1
answer
408
views
Ansible; add hosts to inventory by script
I just started working with/learning to use Ansible.
I want to add hosts to an inventory file using a script, and I am wondering if there is a command line tool to accomplish that.
Something that ...
0
votes
1
answer
2k
views
CMD - Check if exist firewall rule, and add if not
I need some help to make an script that check if exist a rule, and add if not.
It auto add all exe inside a folder where i run it.
@echo off
cls
Echo.--------------------------------------------------...
0
votes
2
answers
262
views
PowerShell: Why am I getting this error?
I am trying to use the PowerShell Invoke command. I am using it correct but I don't know why I am getting an error.
Invoke-Command Get-EventLog –LogName Security –Newest 100 -ComputerName WIN-...
0
votes
1
answer
3k
views
How to select using script on Task Scheduler the "run with highest privileges"
Hi I'm doing some scripting to add a task on a Task Scheduler. However I need to have a script to select the "run with highest privileges".
Sample code:
Dim settings
Set settings = ...
0
votes
2
answers
1k
views
Download with Wget only if new version
Good morning,
I have a custom software that updates with a custom script.sh.
Part of the file goes something like this:
if [[ $software == A ]]
then
echo "downloading package..."
...
0
votes
2
answers
60
views
How do I make a script asks the user for input to put in a variable in the script itself?
As the question suggests, I made a script that inserts a specific statement in a specific line in *.ovpn file, How can I make the * as an input argument so that the script will ask me for it when I ...
0
votes
2
answers
596
views
Is there a way to set up postgres to authenticate users based on the user they are logged in as?
I want to run queries on my postgres databases from scripts and whatnot, without having to do what I do currently:
sudo su - postgres
psql -U USER ...etc
This is cumbersome because I have to type 2 ...
0
votes
1
answer
793
views
Using PsInfo with a Timeout Procedure (or piping through PsExec?)
We have a problem with people in our company leaving their computer running 24/7 even over weekends. Our corporate policy is to shut down when not in use but that doesn't always happen. So what we ...
0
votes
1
answer
2k
views
Script to storage vmotion from one datastore to another
Ive done some searching and could not find what I'm looking for so I am making a post: I would like to storage vMotion from one datastore to another, 10 at a time, and output the vm's migrated to a ...
0
votes
1
answer
366
views
Powershell - piping in related variables from a list
I am trying to export formatted folder ACL permission list for a limited set of folders on a file server.
I have a list of folders to read out permissions from and a list of file names that I want to ...
0
votes
1
answer
2k
views
Appending deployment.properties to enable TLS
I need to be able to append everyone's deployment.properties file to add additional lines to enable all versions of TLS. Big enterprise uses multiple different versions of Java and also multiple ...
0
votes
1
answer
24k
views
Appending to an array within a ForEach-Object loop
I've run into a strange problem when attempting to append to an array from within a ForEach-Object loop that is traversing another array.
I have attempted to recreate the problem as concisely as I ...
0
votes
1
answer
374
views
Powershell script - check exit code
Hi I have the following script:
foreach ($server in $ProductList.$SelectedServer){
Invoke-Command -ComputerName $server -Credential domain\user -ScriptBlock {
Import-Module WebAdministration
echo "...
0
votes
1
answer
62
views
ssh script doesn't work
Hi guys I need some help, I wrote a script to connect to multiple ssh hosts but the script only work with the first IP the other ones didn't change.
Here is my script:
#!/bin/bash
HOSTS="192.168.120....
0
votes
3
answers
2k
views
private ip addresses in public DNS servers [closed]
I'm looking for a DNS service provider that allow me to:
Add LAN IP addresses as A record. For example I need to add 192-168-0-1.example.com mapped to 192.168.0.1. I've tried godaddy and cloudflare. ...
0
votes
2
answers
462
views
Pure Perl RPM Version checker
I have a machine located in a secure environment that does not have access to the internet. I has a base load of CentOS with a handful of additional RPMs. This includes a basic install of PERL with ...
0
votes
3
answers
11k
views
Running Exchange Powershell script from a batch file: command doesn't work. What's wrong with my syntax?
Coming from this question here: How to create a script for Exchange Powershell to modify settings for all shared mailboxes?
Here is my Powershell script (scroll right to see all):
$Mailboxes = Get-...
0
votes
1
answer
2k
views
Script removal of Insider Hub app-Win10
I'd like to script the removal of the Windows 10 Insider Hub app. I've had no success with Powershell-admin: get-appxpackage -allusers -name *insider* | remove-appxpackage
I can do it manually in the ...
0
votes
1
answer
635
views
IPTABLES nat to LXD Containers
I created the following temporary rule that I enable occasionally but I would like to remove it without the need of restarting the machine.
Can someone provide me the command?
sudo iptables -t nat -...
0
votes
2
answers
101
views
batch usb letter execute command
I have and batch script to execute a command to delete several ext.
Example:
set /p drive=Choose the letter of usb:
if %drive%== E goto E
Example (if you choose E)
E:
del /f /q E:\*.lnk *.inf *....
0
votes
1
answer
138
views
When triggered, run script at top of the hour
I have a service that must be started at the top of the hour, any hour. Whenever that service goes down (during a reboot, etc) PRTG Network Monitor will know. PRTG has the ability to run a script when ...
0
votes
1
answer
224
views
Automate s3fs-fuse install
I'm trying to write script to install s3fs-fuse, but i don't know how to change directory in a bash script. These are the script I want to automate
git clone https://github.com/s3fs-fuse/s3fs-fuse....
0
votes
1
answer
108
views
Need looping Powershell script to email me when site has error message [closed]
Running 08 windows server on a VM
We need to be notified by email or by other means whenever the site is either 404 or goes to maintenance page.
Therefore, we need the script to be constantly ...
0
votes
3
answers
4k
views
How do I gather OS information about all users in AD?
I'm looking to make a script or something along those lines which will allow me to check the OS version of all users within the AD, without interrupting daily operations.
So far i've found this script ...