As vfork creates the child process in the same address space as that of the parent, and when execv() is called on the child then how is the parent process restored, as exec loads the file and runs it in the same address space of the parent and hence the child? Answer When execv follows a true vfork, it does
Tag: unix
Demon function on RHEL 7
I have script in RHEL 6 which is using default function such as /etc/rc.d/init.d/functions can we use same functions on RHEL 7 to start the daemon process? . Also let me know, if there is any difference for /etc/rc.d/ between RHEL 6 and RHEL 7? Answer This file is provided by the initscripts package, which isn’t included by default in
Bash script that will read a number from file and run command if number equals or is higher than X value
I would like to have a script that reads a number from a file, and if this number equals or higher a certain value, it will run another command, if not, script will just die, it would be something like this: Thanks for any help. Answer
advanced printf explanation in bash
I just found this programming segment in my son’s Bash file. I am quite a newbie and unable to understand the printf syntax. Can someone explain me the COMMENTED printf in the segment below?? Answer It’s is nothing but a busy/wait spinner and the lines commented do nothing but set a blue foreground color and the last erases the line
How can I execute a command inside another folder and return to original directory?
I use this command to make inside a folder: But I want to return to original directory after the command I tried this: But this doesn’t work. How can I do it? Would help in quick testing… Answer Use a subshell, like so: The shell forks before running the commands in brackets, so once it completes it’s as if you
write error disk full in EC2 Machine [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question
What’s the meaning of a ! before a command in the shell?
What is the purpose of a shell command (part of a shell script) starting with an exclamation mark? Concrete example: In foo.sh: I know that without the space the exclamation mark is used for history replacements and ! <expression> according to the man page can be used to evaluate “True if expr is false”. But in the example context that
Create directories and download files by reading input from a file
Hi! I have this piece of code that reads field by field from the file specified. What I am trying to do here is I am creating a directory that is specified in second field and then I am downloading file specified in first field and then after having that file downloaded I am that file in the directory specified
Understanding Unix Owner and chmod 777
I understand, Unix has 3 levels of ownership: Owner, Group, and Others. The owner is the one who creates the file and later on this Ownership can be moved using ‘chown’. However, I am confused with chmod 777 to ‘others’ or ‘groups’. Executing the previous command on a file will also allow the users in the group/other to have the
Bash poweroff script hangs system
My intention is to cycle through my list of ips and poweroff if my ping succeeds first. However the systems seems to hang. After running this script I can’t ping the systems anymore and they aren’t powered off. If I run ssh 192.168.1.ip “sudo poweroff” through terminal I dont encounter this issue. Any advice? After running a single ssh 192.168.1.40