Questions tagged [shell-scripting]

Programming in an Interpreted language executed by a running Shell

Generic programming in an Interpreted language (as opposed to compiled) executed by a running Shell. Sometimes referred to as "Glue Code" due to the practice of managing the execution and output of one or more compiled binaries and passing said output to another series of commands.

621 questions
1
vote
1 answer

shell script to list directories in decreasing order of disk usage

I am looking for a shell script for Ubuntu Server that lists the disk usage of directories in a decreasing order. It should not list subfolders (recursively). The behaviour should be similar to the Treesize program on Windows and should be in a…
1
vote
1 answer

Jenkins - environment variable not setting up from pipeline

Here is my script. Im trying to set up variables in pipline shell script: node { anyconnect = docker.image('anyconnect:1').run("--cap-add NET_ADMIN --cap-add SYS_ADMIN --device /dev/net/tun:/dev/net/tun -e VPN_USER=${env.USER} -e…
user3069488
  • 169
  • 2
  • 4
  • 19
1
vote
1 answer

Shell script popup with sound

I have a shell script running in crontab to perform certain checks. In case of any problem I want to alert user. For that purpose I am using zenity and play command zenity --error --text='Something has happened!' --display=:0.0 // for pop up play…
Sush
  • 13
  • 2
1
vote
1 answer

Power shell script Get-ADGroup member and owner

I'm having some problems with my powershell script to get ADGroups from our AD. I want the information about what the group name, description of the group, members in the groups and the owner of the group. I have this script written allready…
Hege Jacobsen
  • 79
  • 2
  • 3
  • 9
1
vote
0 answers

LAPS (local administrator password) command

Anyone knows if this is possible to change LAPS command so it sets permissions 1 user to 1 computer? The reason is I want to allow target user to be able to view his computer laps password. Currently, Set-AdmPwdReadPasswordPermission -OrgUnit OU…
guest1
  • 11
  • 1
1
vote
2 answers

Track User CPU usage for a period of time

I need to track amount of processes that a single user invoked and how much CPU-time (or % ) these processes consumed for a given period of time. The trick is that each of these processes normally runs for a split second and consume almost no CPU,…
1
vote
0 answers

Can't use assigned variables after command

I have the following script filename="network_list.txt" while read -r line do name="$line" ping_stat=$(ping -c 4 $name 2>&1) if [ $? -ne 0 ] then echo "server $name is down" else echo…
KTM
  • 213
  • 2
  • 6
1
vote
1 answer

How to catch ssh enabled or not using Shell script for cisco switches?

I have a file of FQDN and I know how to check the ssh. I am using the following command: show ip ssh But I cannot do this manually, so I've decided to write a shell script. But I do not understand how I can check whether ssh is enabled or not…
1
vote
0 answers

how to avoid screen termination once the job is done

using a shell script i am ceating multiple screen in which i m running rsync cmnd with below syntax, n i m able to do so. screen -dmS "$SESSION_NAME" "$COMMAND" "$ARGUMENTS" but as soon as rsync completed , the screen which was generated with above…
1
vote
0 answers

How to validate NFS Snapshot image

I am writing a small shell script which will validate the NFS backup by looking into the snapshot and checking the contents of one directory to make sure the correct contents are being backed up. CreateTestFile.sh - this will create file…
Devesh
  • 111
  • 2
1
vote
2 answers

Crontab vs init.d which one to use for Startup Script?

I have a script that start my docker service and starts my container on RHEL7.3 machine when system reboots. Two ways are working for me: 1) Add script to rc.local 2) Add to crontab -e with path to my script. Which one is better for me as both are…
user432689
  • 11
  • 1
1
vote
1 answer

Jenkins execute shell return value commands vs file

I was using the Execute shell function in Jenkins with a different set of commands (calling the newman testing application). When one of the test cases was failing through newman, my build was marked as a failure. Previous Execute shell newman run…
abd
  • 113
  • 1
  • 4
1
vote
1 answer

Pass parameter from Local to Sudo user

Ok if subject is not clear i will explain my doubt.I have a shell script kept at my local user called (executeAdM.sh), and when i execute this script i am connecting to SUDO user by taking commands from instruction file.But when i execute this…
1
vote
1 answer

How to write standard output and error to log and from exec

For example, write standard err and standard output to $LOG. but this not print anything to standard output ( on console ) #!/bin/bash LOG=/var/tmp/log #... exec > $LOG 2>&1 my target is to write to $LOG on any standard output and standard err…
shalom
  • 461
  • 13
  • 29
1
vote
1 answer

How to escape double quotes and exclamation mark in password?

I have the following code: curl -s --insecure -H "Content-Type: application/json" -X POST -d "{\"username\":\"$1\",\"password\":\"$2\"}" http://apiurl In the above curl command I want to escape the " and ! in the password. I have modified the curl…
me24hour
  • 11
  • 2