1,891 Topics

Member Avatar for
Member Avatar for mamtha

I am using the below code to return the pid. But it works only if the pid is 4-digit. It returns nothing if the pid is 5-digit (see the examples). How do I fix this code for both the instances. Thanks in advance! Mamtha pid =ps -fu truecomp | grep …

Member Avatar for sbecker
0
94
Member Avatar for javavsdotnet

i have DSL router with an ip address a.b.c.d i want to write a Linux script, which when executed can restart the router. Please can anyone help me out? thnx in advance.

Member Avatar for DimaYasny
0
39
Member Avatar for sbecker

I doing a proof of concept script to automate getting a field from ps. Currently, the script takes 2 imputs and I'm almost there but cannot get awk to recognize $2. I want to invoke it like this: #./script init 2 (search for init and get PID). Obviously, $2 to …

Member Avatar for eggi
0
77
Member Avatar for Imti
Member Avatar for xthexonex

Hello all! I am fairly new to linux. I am using fedora7 bash. I am using an awk statement to extract several fields from a file and assign them to variables within awk. With some fields in that file and some variables made within awk i would like to use …

Member Avatar for ghostdog74
0
102
Member Avatar for ionzone

Hi, I am trying to make a shell script that will parse lines off error_log of Apache and parse IPs off of it. The lines I need to parse are security warnings made by ModSecurity. Example: [CODE][Fri Feb 22 22:18:46 2008] [error] [client 111.222.11.22] ModSecurity: Access denied with code 406 …

Member Avatar for dandan
0
205
Member Avatar for Jojo_DC

Does anyone know of a simple way of automatically sending replies to emails, which can repeat X amount of times. For example, I want to reply to an email from John Smith 20 times with "ABC" , "DEF", "EFG"....etc.. sequentially.. Thanks..

Member Avatar for eggi
0
83
Member Avatar for meak99

Looking for some help in renaming files using a shell script. Suppose I have a directory which contains several files, some of which are `*.dat` files. If there are 7 `*.dat` files, I would like to rename all 7 `*.dat` files to `*.01`, `*.02`, ... `*.07` Here is what I …

Member Avatar for eggi
0
135
Member Avatar for larryperl

[CODE]Programname=$(basename $0) # While scheduling to cron, program name is needed. Usage="Usage: $Programname [-a mtDelete/mtBackup] [-l/-L Backuplocation] [-t now/cron/hh:mm]" IsCronJob=1 # default, script will run at now. isBackUp=0 # default, it will take back up. lFlag=0 # it is optional. default value is zero LFlag=0 # it is optional. dfault …

Member Avatar for eggi
0
100
Member Avatar for chris5126

hi guys, Im in the process of writing a unix mointoring program that will monitor differenet servers all runnning solaris . I am creating a main screen with summary warnings for high cpu usage, low disk space, meta device faults, high network collisions etc. All has gone well but now …

Member Avatar for eggi
0
155
Member Avatar for abhey_1998

Hi, I am in need of writing a shell script to read, database table and email the results to a list of users. Please let me know if I could provide further info. Please assist. Thanks, -Abhey

Member Avatar for abhey_1998
0
125
Member Avatar for Prince89

Hi Friends, I am new to this forum as well as new to shell scripting. I have a problem here and i need someone to solve this. Let us consider there are two processes(abc & def).There is a script which kills these two processes(i.e killtheprocess abc). Here abc is the …

Member Avatar for chunchuwar
0
109
Member Avatar for John Jack

I want a shell script to delete files in a backup directory. The files in the directory are named according to dates. For example raw_backup071208:061727 (%y%m%d:%H%M%S). I want to compare the dates and make sure that the file is one week old before i delete it. Thanks John

Member Avatar for eggi
0
66
Member Avatar for larryperl

Here is part of my code- [Code] extrafiles1=$(ls mt.*.*.*.*) if [[ $(ls -l $file 2>/dev/null) = *$today* ]]; then if [[ $file -eq $extrafiles1 ]];then rm $file fi fi [/code] when i am running the script it's showing an error-- mtclean[239]: ./mt.log.8882.-5.1202989443474: bad number. when i just ran this command …

Member Avatar for DimaYasny
0
120
Member Avatar for kursist

Hi, I am new to bash scripting. I have some questions here, Can anybody help? I have a text file which has the following format. UserNam User full name road and house nr. post nr, city phone, mobil Department, job The first thing should be to open file and find …

Member Avatar for kursist
0
107
Member Avatar for htamayo

Hi, I'm trying to use a code that change the wallpaper automatically, but I obtain the next error: Line 18: Unexpected EOF while looking for matching `` ' Line 25: sintax error: Unexpected End of File I think the code line is: cnt=`wc -l "$temp_bg_list" | cut -f1 -d " …

Member Avatar for eggi
0
104
Member Avatar for MONITORING

I need to write a shell script which does the following: script shld be in such a way that I just need to pass a parameter and it shld generate the report by running a sql script and store it in a directory and email this report in every 30mins …

Member Avatar for shamgar
0
108
Member Avatar for alex05

I have to write a script called trying. The script takes a full path (like /users4/st/jdoe/prog.c) as an argument and displays the path and the file name. For /users4/st/jdoe/prog.c, the path is /users4/st/jdoe and the file name is prog.c. I know that I can use grep for it, but it's …

Member Avatar for msr_viz
0
243
Member Avatar for larryperl

Hiiii, here is my script-- [Code]: BackupLocation="$OPTARG" if [[ $LFlag -eq 1 ]]; then echo "Either option l or L should be given to $Programname" echo "$Usage" echo "$Programname is terminated" return $ERR; fi if [[ $isBackUp -eq 1 ]]; then if [[ ! -d $BackupLocation ]]; then echo "Non-existant …

Member Avatar for DimaYasny
0
177
Member Avatar for larryperl

Hiii, i have a doubt here-- [CODE] DirCleanupList="logs tmp corefiles" echo "$DirCleanupList" | perl -ne 'print join("\n", split(" ")) . "\n"; ' for dir in $DirCleanupList do BackupLocation="$BackupLocation/$dir" mkdir -p $BackupLocation >/dev/null 2>&1 if [[ ! -d $BackupLocation ]]; then echo "Unable to make backup directory: $BackupLocation" continue fi done …

Member Avatar for eggi
0
104
Member Avatar for anythingany

could you please find a solution for this script (called phone) that creates a simple telephone list (create an empty file called “phonlist” in home directory) . Each line in this file consist of two fields name and the phone number, the script should do the following: When user types …

0
55
Member Avatar for Robbieg6

Hey all, first post here and as im sure once i ask my question.. you will all know that i am very new the shell scripting. I spend all of time in php, not shell. I need to figure out a way to see if a shell varable has a …

Member Avatar for eggi
0
104
Member Avatar for CodyOebel

Ok, I have noticed that everything I like to do in windows using c++ can easily be done with .vbs scripts. Just to clarify the books I looked into buying to teach me .vbs all mostly talk about vbscripting for html??????????????? Is that what .vbs scripting is usually for .. …

0
60
Member Avatar for larryperl

Here is mywhole script. [CODE]WhenToRun="01:00" FilesToDelete="*log* *.log*" FileLocation="$INTAS_INSTALL_DIR/envs/logs" if [[ ! -d $FileLocation ]];then echo "The FileLocation specified in Non-Existant" fi Progname=$(basename $0) Usage="Usage:$Progname"'[-a <delete or backup>] [-l|-L <backup location>] [ -t <time>]' IsCronJob=0 if [[ "$1" = "cron" ]]; then . ~/.kshrc IsCronJob=1 if [[ -z "$INTAS_INSTALL_DIR" ]]; then …

Member Avatar for larryperl
0
153
Member Avatar for lookof2day

Hi I'm trying to compare two files names using the function given below. The files to be compared are named as xxx_yyy_abc_def_.rtf && xxx_yyy_abc_def_.html The extentions and the underscores are removed from the file names and then stored in two different arrays. So the file names stored in arrays are …

Member Avatar for lookof2day
0
135
Member Avatar for Pichard

Hi I have searched for a way to replace odd characters in a FOLDER NAME. All search-and-replace issues I have seen, only involves how to make search-and-replace on a FILE och with TEXT INSIDE a FILE. My problem is with the FOLDER NAME. My case is this: I have a …

Member Avatar for radoulov
0
96
Member Avatar for Shibani

I don't know if this is the proper forum for my question, but I'll give it a try. We have a few standalone Java applications sitting on a remote AIX box. These applications are listeners, so they start up and wait for events, i.e. they remain running, kind of like …

Member Avatar for Shibani
0
66
Member Avatar for rajasekaran.k

hello Guys,,,, I got Oneproblem in Running Two Threads Regusivily,,,, anybody of u,,,,,, can clear my dobght in using thread _join()..function in two threads.....

0
54
Member Avatar for CodyOebel

Im developing an application console based in c++ , and needed a quick and easy way to script an outlook email. I found the below script to use which works great, but for one problem. PROBLEM: When the script is ran, outlook prompts me to let me know an application …

0
61
Member Avatar for MONITORING

I am trying to create a folder with in a folder by passing a parameter. this is what I am trying to do parameter I am passing in a function today(date) is 20080124 and declared a variable dir=/ab/bc I want to create a directory with this this parameter value with …

Member Avatar for MONITORING
0
99

The End.