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
4 answers

Running a bash script as root on boot

i have a script that calculate an ip address (using gateway address) than change, the script work when i launch it manually with sudo sudo ./changework.sh i want this script to run during bootup time i sudo cp changework.sh…
0
votes
0 answers

Subshell failing when run through cron

I have a file: /etc/bind/dnsCron/dnsCron.sh I run it via cron every 5 minutes: */5 * * * * sh /etc/bind/dnsCron/dnsCron.sh Inside dnsCron.sh I have a line that succeeds when I run it command line .. But it fails in the cron -- Error…
Zak
  • 354
  • 4
  • 17
0
votes
1 answer

FreeBSD script - different result to manual execution (tcsh)

This question has been asked previously in https://joomla.stackexchange.com/questions/20697/securing-a-joomla-installation-on-apache-mod-php but it may belong here better since it is not Joomla specific. I'm trying to execute a script in tcsh, and…
ExternalUse
  • 165
  • 2
  • 7
0
votes
1 answer

how to convert curl multiple line to one line

I have these curl commands 1. curl -XPUT "http://192.168.1.1:8080/locate" -d' { "crap": { "crazy": 1 }, "asap": { "peg": { "properties": { "url": { "type": "string", …
uberrebu
  • 503
  • 6
  • 17
  • 36
0
votes
2 answers

Systemd not starting an app from wrapper

I've created a simple wrapper for Elasticsearch and a systemd service file, and for some reason I am not able to start Elasticsearch from systemd, however I'm able to do so from the wrapper itself. Here's my (very simple)…
Fadi
  • 170
  • 10
0
votes
1 answer

How to show lines where uniq more than 3

I have a file, where i should make "uniq" and show result. My file: 178.57.66.225 fxsciaqulmlk 178.57.66.225 fxsciaqulmlk 178.57.66.225 fxsciaqulmlk 178.57.66.225 faaaaaa11111 178.57.66.215 terdsfsdfsdf 178.57.66.215 terdsfsdfsdf 178.57.66.215…
Valeriu
  • 57
  • 2
  • 9
0
votes
3 answers

How to output column with special patterns

I have a column, with some words: scatman batman superman scatman scatman batman superman scatman scatman batman superman scatman batman WWWWWWWW superman scatman batman superman scatman I should make some patterns, where i need to have word by…
Valeriu
  • 57
  • 2
  • 9
0
votes
2 answers

Execute command on multiple files

I need to execute jpeg-recompress on thousands of files. I've tried: for image in *.jpg; do image2=${image%.*}.jpg; ./jpeg-recompress /path/to/images/$image /path/to/images/$image2; echo "Processing $image2 file..."; done But fails to…
0
votes
1 answer

Placeholder in bash/shell for defferent linux distr

i have some problem. I need to add in autorun of linux, some scripts. But in my infrastructure, i have a different distrs. Of course, the way of adding this scripts in autorun different. In CentOS it is chkconfig, in debian/ubuntu it is…
0
votes
1 answer

How to automatically run Node.js server on Apache with Shell Script

I usually access my application via Putty and do exactly what I show below to let my Node script running in the background: screen cd /var/www/node node app.js I'm using Ubuntu and I have already created an AMI of my instance and now I intend to…
Igor
  • 135
  • 7
0
votes
1 answer

Dovecot and script execution - permission denied for a system command

I have a shell script which is looking for a mailbox path result=`find /var/mailboxes -type d -name me@my-domain.com` perl -pi -e 's/Folder-to-Remove//g' $result/subscriptions but executing it via Dovecot Sieve I'm getting an error message: lmtp:…
JackTheKnife
  • 371
  • 1
  • 6
  • 24
0
votes
2 answers

Regular expression for second and third domain level with hyphens

I have some smart script, that check name of server and get domain name. For example, i have name of server: example.ru01. I need to get: example.ru My scipt: #!/bin/bash hostname=example.com01 echo…
0
votes
2 answers

Doesn't work regular expression for domain with hyphens

I have some smart script, that check name of server and get domain name. For example, i have name of server: example.ru01. I need to get: example.ru My scipt: #!/bin/bash hostname=example.com01 echo…
0
votes
4 answers

Getting a Windows machine's MAC address

OK guys, this is not the usual easy to answer question the title may imply... I need to get the MAC address from a machine running Windows (ranging from XP to Server2012). I have the following option that I can use: 1) getmac - Fine in general and…
0
votes
1 answer

Delete sub-directories with a specified name length

I have an automated deployer script, which takes a git commit to a certain branch, compiles and uploads the archived binary objects to cloud (S3). Later on, the script logs into an EC2 instance and downloads the archives and executes/starts the…
hjpotter92
  • 670
  • 1
  • 10
  • 20