All Questions
Tagged with rhel shell-script
106
questions
0
votes
0
answers
56
views
dhclient exit hook cannot write to directory
I am using RHEL 8.9 and have created a basic dhclient hook script in which I want to log to a file.
The script is able to write to places like /tmp, but not /opt. It can read files from /opt, but not ...
3
votes
3
answers
295
views
Add a tab to the beginning of lines stored in a variable
I am working on a script that will process a .zip file received from clients. It is common in my job to want the contents of the .zip file received listed within a log file as a means of validation. I ...
0
votes
4
answers
700
views
Cron Job: Best Practices
I have written a bash script which will be setup as a cron job in the future.
During the script development I have added echo lines to help me follow and debug my code, like the code snippet below:
#!/...
-2
votes
1
answer
175
views
Need to batch rename files with names from text file using core utils
So I am a bit of a noob and have a problem at work. There is a program outputs names in a ie
apple
banana
orange
P1n34ppl3
The problem is that the files that correspond to that (separate program) are ...
0
votes
0
answers
12
views
Why does this nohup script appear to stop working after an unspecified amount of time? [duplicate]
This script, named tailscript.sh, tails a .out file looking for an occurrence of the string 'SocketException' and then executes another script, named lsof.sh.
#!/bin/bash
# Run the script in the ...
0
votes
2
answers
224
views
RHEL7 Cron entry gives ambiguous redirect error? [duplicate]
We have a crontab entry that ends up sending an ambiguous redirect error. Pretty sure it's the command to read the date, but don't know how to fix. Are there other solutions?
/bin/sh redirects to /bin/...
1
vote
1
answer
164
views
secrets unintentionally printed to cloud-init logs
The two lines of bash code below pull a secret into a cloud-init script for an Azure VM running RHEL8. But each of the two lines has an unintended side effect of printing the secret into the cloud-...
0
votes
2
answers
187
views
Replace all character to space until it meet the first /
This is the string (it is the value of a shell variable):
2908104 /var/cache/yum/x86_64/7Server/Patches/gen
Expected output:
/var/cache/yum/x86_64/7Server/Patches/gen
How to retrieve only the value ...
-1
votes
1
answer
963
views
bashrc + why source not refresh the .bashrc file
we add the following line to bashrc file
alias reboot="echo you not allowed to do reboot on this machine - sorry"
so we get
more ~/.bashrc
# .bashrc
# User specific aliases and functions
...
0
votes
0
answers
723
views
How to end curl command
I want to execute a curl command
curl "https://172%40-34%40-40%40-66.cl-api-tst.pod.dcr.non-prod.ichp.ing.net:8443/xyz/bla-bla/search/"
but this command never ends and execute the terminal ...
0
votes
2
answers
2k
views
How to ignore the error from mv: cannot move ‘XXXXXX to a sub directory of itself
On our RHEL 7.6 server we create the following folder
# mkdir -p /var/data/data-logs_temp
the second part is to move all content under /var/data/ to /var/data/data-logs_temp by:
# mv /var/data/* /...
0
votes
1
answer
698
views
Kickstart from USB and Exclude the USB drive for Installation
During the installation my script is searching all the disks of the system.
Usually the USB is assigned with sda.
What would be the most appropriate way to prevent the USB disk as a candidate disk for ...
0
votes
1
answer
404
views
Migrate shells Solaris ksh to Red Hat
We have hundreds of shell scripts running on a Solaris 11.3 server. System shell is ksh93
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 13 Apr 12 2018 /bin/sh -> sparcv9/ksh93
All the ...
1
vote
1
answer
95
views
Until / do loop achieves desired effect but throws several syntax errors
The following bash script executes a second bash script and then waits to observe effects of the second script using until / do. This script is running on a RHEL7 server.
FILE=/sentinel_failover.sh
if ...
0
votes
1
answer
1k
views
Having the output printed on the screen and redirected to a file and forwarded the errors to another file
I’m trying to answer this lab question. Is there a way to solve this without using tee command?
As user1 on server1, run the ls command on /etc, /dvd, and /var. Have the output printed on the screen ...