I have been looking for some solution to restart app inside tomcat server on remote linux machine but i haven’t found anything yet. Can anyone please tell me how can i restart the application in Tomcat Server after some time interval without restarting the tomcat server on remote machine? Can anyone help me out with the Bash Script and CRON
Tag: bash
How to insert a delay between pipelining commands in a bash script. E.g. cat file | telnet mail.domain.com 25
I have a bash script that creates a file and I would like to send an email at the end via telnet. However sometimes it will execute and sometimes it won’t. The command at the end is At the receiving server I see in mail.log the following error when it fails: The same script works perfectly if instead of mail.domain.com
How to copy directories into a directory using install in bash?
Assume the nested directories foo/bar and a empty directory dest. I would like to call something like install foo dest such that dest contains the directory foo/bar. I have tried the following: install foo dest => install: omitting directory “foo” install -d foo dest => nothing happens Answer You want to use cp -r instead:
Doesn’t sh support process substitution <(…)?
On a Centos 6 machine, this works: and this doesn’t: I get: Nevermind the grep and tail. The problem is with the process substitution thingy: <(…) Can someone tell me what sh does differently here? [EDIT] Thanks for the answers! The problem arose while using capistrano for deployments. It defaults to using sh but I changed that to bash now.
How to find files recursively by file type and copy them to a directory?
I would like to find all the pdf files in a folder. It contains pdf files inside and more directories that contain more as well. The folder is located on a remote server I have ssh access to. I am using the mac terminal but I believe the server I am connecting to is Centos. I need to find all
Connect to a VPN Connection in Ubuntu in bash
How can I connect to a VPN Connection when I can use only bash (terminal)? I create a connection but I want to connect or disconnect using remote ssh connection Answer you can use nmcli to do that. this program is use for network management. you need to save the password of that connection before you use this command. For
How to call variables from ip.txt file to .sh file?
I have list of ip addresses in one txt file which I have named ip.txt I want to call those ip in my .sh file, I am not sure how to proceed here.. here I did soemthing Please tell me how to do that? Answer This should make it: or using for as you do because the syntax is: for
Delete files older than X minutes
I would like to delete files that are older than 59 minutes. I have this so far: This doesn’t work and seems to delete all files. I’ve tested this several times and I think the issue is to do with daystart. I’ve read the man page and it seems to base time on the beginning of the day rather than
Multithreaded Programming with Bash Script
I am running a bash script as like that: Every time when I send a request I have to wait to finish it and write to a file and after that it continues to looping. However I want to do it asynchronously. I mean that it will send a request and loop without waiting response. However when a response comes
how to include a file containing variables in a shell script
i have many script shell and i want to include a file containing variables in this shell script? My var script: My script sh: Thx. Answer It depends which shell, but one of these two usually works: or I’m not sure about ksh, but I’d imagine both would work.