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
0
votes
3 answers

How can I make this script better?

I was wondering if there is a better way to create a file other than appending each line to the file. I did it this way so I can preserve readability, however, there is no indentation. Is there a way to create a file and input multiple lines at…
Strawberry
  • 1,132
  • 4
  • 15
  • 27
0
votes
1 answer

What is the correct way to check monit status/summary success/failure

I have monit utility on production for monitoring several daemons (our micro-services). I'm trying to figure the best way to unmonitor/monitor my daemons while updating them. So, basically I need something like this, pseudo-code: has_monit =…
0
votes
2 answers

trying to see if how many times service Accounts was logged in

Hi I am new to shell scripting ,I am trying to see how many times an accounts were logged in the log file. If an account was logged in more than 20 time I need the name of those accounts to be printed. I was trying something on the below…
NJN
  • 1
  • 1
0
votes
1 answer

Unable to List Contents or Create Files in /var/tmp Folder from PHP Executed Bash Script

Objective: I want to trigger a webhook on a private linux-machine (its a local system not connected to internet), which can delete the spool data generated by CUPS server in /var/tmp folder. To achieve this Approach1 I 1st checked the default CUPS…
0
votes
1 answer

time nohup ./script --> the time hasn't been logged

I need to measure the time that Firefox takes to build itself from the source code. Here's what I do normaly: nohup ./mach build > my_log.log & I then prepended time to it: time nohup ./mach build > my_log.log & However, this hasn't made it…
0
votes
0 answers

How to avoid duplicate entries in DNS Bind cache db file?

While running command "rndc dumpdb -cache" it has huge amount of data some duplicate entries like one domain has multiple entries with same target but different TTL, how to reduce like update only requires those parts which are new or haven been…
Sha
  • 1
  • 2
0
votes
1 answer

Change Ubuntu server password every 7 days and do autologin

am working on a scenario where i need to Change Ubuntu server password every 7 days and do autologin. i tried with breaking the problem: command to create user with password: useradd -p $(openssl passwd -1 "krspassword") krs than using the cron to…
0
votes
2 answers

Best Path for nginx Files

I've always struggled with various paths for nginx files and where they should be positioned. As we know, we can change where we can park both the www directories for our web app, as well as the associated log files. The issue that I've found is…
Rich_F
  • 125
  • 8
0
votes
1 answer

Bash loop through dates

I'm trying to copy data from psql via a bash script now I'm stuck with a loop my bash script is as following: #!/bin/bash DATEBEGIN=2016-03-01 DATEEND=2016-03-31 DATEMONTH=2016-03 echo "Copy data to /mnt/bigstorage/samples-$DATEMONTH.csv file,…
0
votes
1 answer

Setup Apache Docker container to keep running after executing php shell CMD

I'm trying to run a Docker container based on: PHP 8.1 Apache 2.4 MariaDB (latest official docker image) Dockerfile: FROM php:8.1-apache WORKDIR /var/www/html/ RUN pecl install xdebug \ && apt update \ && apt install libzip-dev -y \ …
DevelJoe
  • 187
  • 3
  • 11
0
votes
0 answers

GAWK not running in crontab

I have the below script running successfully manually. But when it is executed in crontab (below), I dont see anything happening. Script #!/usr/bin/gawk -f #!/bin/bash PATH=/usr/local/bin:/usr/bin #Reading from the file & storing in…
serverstackqns
  • 764
  • 3
  • 16
  • 42
0
votes
0 answers

Initialization of Samba Active Directory in Podman fails

I have created a Samba Active Directory PDC that runs inside a Podman container. I was trying to working on how to restore the server from an offline backup, when I encountered something unexpected on the setup of the backup server. I have a file…
0
votes
1 answer

Variable in AWK

How can I add a variable within awk command? below is my command: cat /home/ubuntu/test/copy.txt | awk 'NR==21{print ".host = "$line";"}1' $line is basically an IP address which is retrieved from a text file. With the above command the output looks…
serverstackqns
  • 764
  • 3
  • 16
  • 42
0
votes
0 answers

Need help to Split the below HTML text file in two parts using linux scripting

I have a html main.txt file, I need help to split it in two parts. headpart.txt and bodypart.txt. Below is my html main.txt text file - Original


Name

Creation…

Goural
  • 25
  • 1
  • 4
0
votes
0 answers

How to assign a bash script for every user created with cubic and how to execute it automatically one time only

Hello to every linux lover, I'm tryng to create a custom ubuntu installation with cubic where I would like that qemu,kvm and virt-manager with all the dependencies worked like a charm. To do that,I need that every user that is created as soon as…
Marietto
  • 143
  • 1
  • 10