Skip to main content

All Questions

Tagged with
0 votes
1 answer
31 views

Permission denied when running a mv command as user after entering into sudoers file

I have a user which needs to move a file to a dated folder. I have an entry into the sudoers file as follows: backupuser ALL=(ALL) NOPASSWD: /usr/bin/mv /var/lib/pgsql/base_backup/*.tar.gz /var/lib/...
Dale's user avatar
  • 3
0 votes
2 answers
118 views

How to automatically source your bashrc file when you become a root user [duplicate]

At my work work we work with multiple people on several RHEL servers. I always login to my Linux servers as my regular user (duh). Assume I have a added extra functions/aliases to my .bashrc file. Is ...
ansible_usah's user avatar
0 votes
0 answers
36 views

pgrep returns correct results only for partial script name [duplicate]

I have a script called synchronize_dirs.sh which just wraps a call to sleep: -bash-4.2$ cat synchronize_dirs.sh #!/bin/bash sleep 60 -bash-4.2$ What's confusing to me is the behavior of pgrep in the ...
Pacopenguin's user avatar
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: #!/...
hymcode's user avatar
  • 83
2 votes
0 answers
56 views

How do I dynamically find a disk with free space to create a separate partition using bash

I would like to first state that I am new to disk partitioning, so if at any point my desired result is an impossible action to be performed on the workstation, kindly enlighten me on the proper way ...
clamismagic's user avatar
0 votes
1 answer
110 views

When logging into a UNIX/Linux box, which profile scripts are executed?

When logging into a UNIX/Linux box, which profile scripts are executed? Typically there are several different profile scripts that set the $PATH variable and other aspects of the user's environment. ...
drewhouses's user avatar
0 votes
1 answer
81 views

Reasons for stty -tostop having no effect [duplicate]

I am trying to get a background process to print to the terminal. I haven't seen anything that otherwise indicates there is anything else to do besides stty -tostop. Am I missing something? Running ...
Sterling Butters's user avatar
1 vote
2 answers
262 views

How to tell when sshd is ready for connections?

I use a bash script to reboot a remote server, then login via SSH to run some commands. My script works most of the time, but occasionally fails with this error: "System is booting up. ...
Elliott B's user avatar
  • 565
0 votes
1 answer
227 views

Using '/usr/bin/cd' in a cron script fails while 'cd' works

I have a simple shell script that I am running via cron. I am using it to perform a scheduled git pull operation (yeah, I know there are probably better methods, but this is another team's repository ...
Nick S's user avatar
  • 103
-2 votes
1 answer
42 views

linux + network scanner tool that discover Linux rhel machine

we have network lab range from 18.2.1.1 until 18.7.252.253 , and we want to capture only the Linux RHEL machines with version 7.x ( /etc/redhat-release ) , ( we have around 2870 machines and only 390 ...
yael's user avatar
  • 13.4k
0 votes
0 answers
802 views

Format date to another date format in bash

I am retrieving the following dates from a database: 2022-04-12-08.22.28.940722 2018-10-30-10.28.10.112309 2022-04-07-14.13.19.426219 In my bash script I am writing them to a file (where the date is ...
Niek Jonkman's user avatar
0 votes
1 answer
81 views

How to loop trough wtmp and extract certain data?

I am using the following command to save wtmp (last command) to a logfile: last -F | grep -i -e pv -e nv -e pp > last.log Result: I want to extract the username (first block) and the time of ...
Niek Jonkman's user avatar
0 votes
0 answers
82 views

Nested for loop inside an ssh -t for loop command

I've been trying to save some time by creating a loop to edit ifcfg files using the sed command. For testing I started by trying the below loop: for k in `cat *FILE CONTAINING HOSTNAME*`; do echo $k; ...
jodell's user avatar
  • 1
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-...
CodeMed's user avatar
  • 5,269
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 ...
KimYao's user avatar
  • 3

15 30 50 per page
1
2 3 4 5
11