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
votes
1 answer

Why there is sleep in log rotation script

I have some problems with nginx log rotation - nginx -s reopen does not reopen the log file, this is why I am researching the topic. In several places, I found this script: $ mv access.log access.log.0 $ kill -USR1 `cat master.nginx.pid` $ sleep 1 $…
Nick
  • 826
  • 2
  • 15
  • 42
-1
votes
1 answer

Bash script in cron job - email when a file has been modified

I looked at this topic to write a bash script that checks if a file has been modified every 60 min and sends me an email using ssmtp if that is the case. Here is its content (monitoring.sh): #!/bin/bash [[ -z `find…
David B.
  • 466
  • 1
  • 3
  • 12
-1
votes
1 answer

env not working in FreeBSD cronjob

On my FreeBSD server, I have setup a cron script for backups using Duplicity. This script is as follows: #!/bin/sh export PASSPHRASE= export FTP_PASSWORD= keyid= remote= excludelist= /usr/local/bin/duplicity --volsize 1000 --max-blocksize=20480…
Compizfox
  • 384
  • 1
  • 6
  • 18
-1
votes
1 answer

Bash add entry to fstab by script

I'm newbies in bash scripting and i try to write script that add entry for cifs windows share to fstab. I writed a litle script but i'm not shure if it will work fine. I haven't linux to test it Can you help me to improve it or fix it? it will run…
user3178250
  • 1
  • 2
  • 5
-1
votes
4 answers

Delete all files except the newest of each day

I have dump directory that is updated regularly. I wish to delete all files that are older than one week. Bash is preferred though other solution are also welcomed.
michaelbn
  • 293
  • 2
  • 10
-1
votes
1 answer

Ubuntu shell: Get tomorrow's weekday

I have a shell script for backups and I need the Weekday of tomorrow. $Today = $(date +%a) #$Tomorrow = ?
Martin
  • 220
  • 3
  • 9
-1
votes
2 answers

Run a script on ssh login

I have a development env. with 4 users, I want to be able to log their time logged in since they are contractor working from home. I have NO idea how to do it, my sys admin left me this weekend and I am lost here. I want to be able to run a script…
Pat R Ellery
  • 11
  • 11
-1
votes
1 answer

Bulk BIND zones creation

How can I create zones for 50 domains on Ubuntu 12 VPS? I have webmin (which allows me to use BIND to create/ manage zones). I was able to figure out what gets created to add a zone successfully. But creating record for 50 domains is time consuming…
-1
votes
1 answer

running script containing sudo in cron

#!/bin/bash value=$(
user1597811
  • 101
  • 2
-1
votes
3 answers

Cannot start a script

#!/bin/bash value=$(
user1597811
  • 101
  • 2
-1
votes
1 answer

Different behavior from ubuntu server and ubuntu client on windows

#!/bin/bash # Reading cat /home/radiare/Desktop/first.txt | while read LINE do if [ "$LINE" == "false" ]; then echo "Inside first loop" break fi done cat /home/radiare/Desktop/second.txt | while read LINE do if [ "$LINE" == "false" ]; then echo…
user1597811
  • 101
  • 2
-1
votes
3 answers

Script to restart httpd if crashed

With heavy trafic, it happen that's my HTTP service crash on my dedicated server. Then, I have to restart httpd service manually. I just search for a shell script that's detect if HTTP service is OK - If not : restart httpd. Thanks a lot if you had…
-1
votes
2 answers

shell: create Shortcut command (alias or function) for working with IP address as arguments

I am not sure if I performed the following illegal or true but what I need is - to create set of ready commands so if I need to use , for example to match IP address with 4 octet I can use the command - command_that_match_four_octet Please advice…
yael
  • 2,433
  • 5
  • 31
  • 43
-1
votes
1 answer

shell script - while loop, handle the exception

I am running a shell script with a while loop and it exits with the below error, how could I avoid it or catch the error and let the loop to continue ? ie how could I handle the exception stty: standard input: Invalid argument Following are the…
Arn
  • 13
  • 5
-1
votes
4 answers

Shell script for loop is behaving unexpected

Shell script for loop is behaving unexpected ! The requirement is need to iterate the loop line by line of the property file. Its mandatory to use the for loop. hostnamefl=/tmp/propperty.txt for property in $(cat $hostnamefl) do hostname=`echo…
Arn
  • 13
  • 5