message script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting message script
# 1  
Old 03-02-2007
message script

Hi All,

I tried to write simple script to push a message to my database server;

#!/bin/bash

txid=1

do
curl "http://10.11.1.100/message/push?Txid=${txid}&Message=This is test message"

((txid=${txid}+1))

done


Question:
1) How i want to stop the script when the txid reach 100 ?
2) Is it possible to record the start date and end date of the script and export it to file? if yes, how?


Hope get your guide. Thank You.

-malaysoul-
# 2  
Old 03-02-2007
Quote:
Originally Posted by malaysoul
Hi All,

I tried to write simple script to push a message to my database server;

#!/bin/bash

txid=1

do
curl "http://10.11.1.100/message/push?Txid=${txid}&Message=This is test message"

((txid=${txid}+1))

done


Question:
1) How i want to stop the script when the txid reach 100 ?
2) Is it possible to record the start date and end date of the script and export it to file? if yes, how?
Code:
date +"Start: %Y-%m-%s %H:%M:%D" >> logfile 
while [ $txid -le 100 ]
do
  curl "http://10.11.1.100/message/push?Txid=${txid}&Message=This is test message"
  txid=$(( ${txid}+1))
done
date +"Finish: %Y-%m-%s %H:%M:%D" >> logfile

# 3  
Old 03-02-2007
Give a Try on this

#!/bin/bash
echo "starting Time=$SECONDS" >logfile
txid=1
while :
do
curl "http://10.11.1.100/message/push?Txid=${txid}&Message=This is test message"
((txid=${txid}+1))
[[ $txid -eq 100 ]] && break;
done
echo "Ending Time=$SECONDS" >>logfile
# 4  
Old 03-02-2007
Hi jacoden,

Thank you. It work now. I also tried cfajohson script but got error about "-le". i will try it again.
# 5  
Old 03-02-2007
Quote:
Originally Posted by malaysoul
Hi jacoden,

Thank you. It work now. I also tried cfajohson script but got error about "-le". i will try it again.

Did you initialize the txid variable first?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX script error message

I have this UNIX script code with a query to export sql table in Oracle and export to csv file. The code gets the data correctly. However, when I run the script second time, I got the error message "not spooling currently" and shows the older data in csv file. When I delete the csv file and run... (5 Replies)
Discussion started by: Hope
5 Replies

2. UNIX for Beginners Questions & Answers

UNIX script error message

Greeting!! I wrote the below script to e-mail me only file names in a specific directory when a file is delayed for some time in a that directory. I am getting unexpected eof error message. I don't want any email if the folder is blank.(if the condition is not met) I am not getting the email at... (4 Replies)
Discussion started by: Hope
4 Replies

3. UNIX for Beginners Questions & Answers

Script to automate a service message

Hi I am trying to figure out, on how to automate whether in a simple script or using awk/sed/grep commands to automate a "service.message" file which has tag separated message stating as; "There is currently no outage or system is unavailable for duration of change....", therefore, when... (14 Replies)
Discussion started by: Gamma
14 Replies

4. Shell Programming and Scripting

How to deliver an error message from script?

Hi I have a script that pick up a file on another server, and place it on a solaris server, but I came across the following error: mget HLR01_21092014? 200 Port command successful 150 Opening data channel for file transfer. HLR01_21092014: No space left on device 426 Connection closed;... (18 Replies)
Discussion started by: fretagi
18 Replies

5. Shell Programming and Scripting

Depend on Script message needs to be invoke anothe script

I have script below #! /bin/bash if then echo "JBoss is NOT running" else echo "JBoss is running" fi If JBoss is NOT running need to be invoke another script i.e jboss startup script /home/vizion/Desktop/jboss-4.2.3.GA/bin/run.sh script from other script not... (5 Replies)
Discussion started by: Chenchireddy
5 Replies

6. Shell Programming and Scripting

Self referencing script error message

Hello again all. I have a user editable script that I'd like to have point out the user error to. Problem is I'm having troubles getting an echoed error message to give me the line. Here's what I'm trying to do. grep -n $loc /this/script.sh where '$loc' is the argument passed to the script.... (9 Replies)
Discussion started by: DC Slick
9 Replies

7. UNIX for Dummies Questions & Answers

Not Found message in script execution

Hi gurus, I'm having a strange problem and I hope you can help me solving it. I'm working in Unix Solaris, version 5.10, ksh. I have a script with environment variables which I have to execute prior to other scripts. The script belongs to userA and when I log in, and cd to its directory. It... (4 Replies)
Discussion started by: ermur
4 Replies

8. UNIX Desktop Questions & Answers

Script that will display a short message

Can anyone point me to the right direction on how to write a simple script that will display a message on any terminal when implemented? Basically I need it so the script runs at a certain time, say April 30, 2010 and that the message will be displayed to me no matter which terminal I am logged... (2 Replies)
Discussion started by: jmack123
2 Replies

9. Programming

How to limit max no of message in a posix message queue

Hii can anyone pls tell how to limit the max no of message in a posix message queue. I have made changes in proc/sys/fs/mqueue/msg_max But still whenever i try to read the value of max. message in the queue using attr.mq_curmsgs (where struct mq_attr attr) its giving the default value as 10.... (0 Replies)
Discussion started by: mohit3884
0 Replies

10. Shell Programming and Scripting

bare message script

hey is there a way or write a scipt to send messages to other people without using pre existing applications such as "write" or "to" (1 Reply)
Discussion started by: yngwie
1 Replies
Login or Register to Ask a Question