Script to automate a service message

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Script to automate a service message
# 8  
Old 10-25-2017
I would generate the file completely rather than editing it. Replace it each time, rather than trying a brute-force regex and hoping the different text won't mess it up each time. Much more reliable.

Code:
( cat header-file
echo "part of text that varies"
cat footer-file ) > /path/to/outputfile

Without seeing the file you want edited we really can't help you much further. And I suppose you can't post it.
# 9  
Old 10-26-2017
Hi

Yes, its pretty small file but Yes, it would be difficult to But what I have done is replaced with dummy text where it occurs and shown below:

The only bit that needs changing and automating is the highlighted in RED below: Hope this Helps.

Code:
 <p><strong>Welcome to  ABC </strong><p>
<p>ALL TEXT HERE.... </p>
 <p>ALL TEXT HERE. </p>
 <hr>
<p>Text Here</p>
<p> Details <br> Email: <a href="EMAIL">EMAIL ADD </a></p
>
 <p>Hours of Service: 24x7 for Priority  incidents, 07:00 to 17:00 Mon to Fri (excluding public holidays) for all other priorities
s.</p>
<hr>
<p><strong>Service Message</strong></p>   (HERE Text needs to be added)
<p>There are currently no outages planned </p>
<br>
<hr>

Thanks


Moderator's Comments:
Mod Comment
Please wrap all code, files, input & output/errors in CODE tags
It makes it easier to read and preserves spaces for indenting or fixed-width data.

Last edited by rbatte1; 10-26-2017 at 08:55 AM.. Reason: Code tags
# 10  
Old 10-26-2017
Code:
#!/bin/sh

cat > /path/to/outputfile <<EOF
 <p><strong>Welcome to  ABC </strong><p>
<p>ALL TEXT HERE.... </p>
 <p>ALL TEXT HERE. </p>
 <hr>
<p>Text Here</p>
<p> Details <br> Email: <a href="EMAIL">EMAIL ADD </a></p>
 <p>Hours of Service: 24x7 for Priority  incidents, 07:00 to 17:00 Mon to Fri (excluding public holidays) for all other priorities
s.</p>
<hr>
<p><strong>$1</strong></p>
<p>There are currently no outages planned</p>
<br>
<hr>
EOF

Use it like ./script.sh "Service Message" to regenerate the file.
# 11  
Old 10-26-2017
Hi

I will give that a go tomorrow after I have added the text and what type of service message to be added and will see how it works.

I don't need to amend anything else or pass any parameters?

./script "service message" to run the script

Let you know.
Thanks.
# 12  
Old 10-26-2017
No matter what you do, keep a backup of the original message file.

If the actual file is different from what you showed you'll need to change it, of course.

The script will need to be set executable to run, also.
Code:
chmod +x ./script

# 13  
Old 10-26-2017
Hi

Yes, will take a backup of the original service.message file and then try this code and see if it works....

  • I can add few lines of text, where service message is there is no min/max char values to input text between the below lines of code?
  • <p>There are currently no outages planned</p>
    <br>
  • You mentioned path of output file: /data/profiles/content/(filename) and will make the script executable of course.
  • That's ALL the file contains as I have shown you ONLY text I changed.
Thanks.
# 14  
Old 10-30-2017
Hi

Thanks, I have tested the script and it works as expected showing the edited message.

However, I we don't want users(Transition Team) to be modifying the script's so incase something else mess ups. Therefore,

Can we call 2 files with the script as follows

file 1-service_template (which will have all the welcome board message, numbers/emails etc)

file 2-service_message.txt ( This will have a paragraph of message in this file...)

file 3-Will be our initial script which when run calls these two and updates, so no one actually modifies the script, rather than the ONLY service_message.txt file which will have the outage message few lines.

How can I achieve this, as I have created the first 2 files and the script portion is which needs more addition or amendment?

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

automate the script

Dear all, I I want to login to my Linux machine using putty and then run some script from Windows machine.we can do it after loging it and then execute the script by typing it in putty command line screen. but I want to automate it.So whenever I will fire this script,it will do the following... (4 Replies)
Discussion started by: smartgupta
4 Replies

2. AIX

Short Message Service from AIX

Hi AIX Guru's, I am a bit new to this AIX stuff . Does anyone of you know how to send SMS messages from an AIX box. We are able to send emails to the internet from this AIX box , and I was hoping sending SMS's would be something similar Any help would be greatly appreciated . Please... (4 Replies)
Discussion started by: smdasim
4 Replies

3. Shell Programming and Scripting

mail script to automate

Hi, Here below the logs from the mail server: less /var/log/messages: Sep 6 04:03:31 server-59 out: 1252227811|webmaster@zilia.com|antonino.granata@gmail.com|2175|success|1 Sep 6 04:03:33 server-59 in: 1252227813|news@tarot.com|junk@thess.com|30376|success|1 Sep 6 04:03:35 server-59... (8 Replies)
Discussion started by: gsiva
8 Replies

4. Shell Programming and Scripting

How can I automate a script?

Hi All, Can I automate a script when some one trying to 'vi' (open) a file. For Example, I am having a file named 'SecuredShell.sh'. when a user types " vi SecuredShell.sh " in unix command prompt a script named secure.sh needs to be automated. Can this be possible. if Yes please guide... (2 Replies)
Discussion started by: little_wonder
2 Replies

5. UNIX for Dummies Questions & Answers

Message Service Using kannel

Any body having idea or implemented SMS service with kannel..? Please help... (1 Reply)
Discussion started by: noufal
1 Replies

6. Shell Programming and Scripting

Automate Script ***V. Urgent

Hi All, ./procdure.ksh which opens the below the menu, I want to build a script which will press 4 and run the Sector Data Automatically (instead of pressing option 4 manually) Is there any way for this, please let me know... 1) FX Rates MDU 9) Fidessa Cash... (7 Replies)
Discussion started by: niceboykunal123
7 Replies

7. Shell Programming and Scripting

Automate shell script

I would like to automate script where i do not have to manually insert the username and password I wrote two different scripts but not able to achieve the results: here's to scripts i wrote #!/bin/bash cd /var/tmp /home/server/steve/pca --askauth -idx /opt/app/bin/expect <<EOF expect... (3 Replies)
Discussion started by: sam786
3 Replies

8. UNIX for Advanced & Expert Users

Shell Script to Automate

I would like to automate script where i do not have to manually insert the username and password I wrote two different scripts but not able to achieve the results: here's to scripts i wrote #!/bin/bash cd /var/tmp /home/server/steve/pca --askauth -idx /opt/app/bin/expect <<EOF expect... (1 Reply)
Discussion started by: sam786
1 Replies

9. Shell Programming and Scripting

here document to automate perl script that call script

I am trying to use a here document to automate testing a perl script however when the perl script hits a system(perl subscript.pl) call, input is no longer entered into this subscript. here is my script $ cat test.sh #ksh for testcase do program <<-EOF | tee -a funcscnlog.log y... (3 Replies)
Discussion started by: hogger84
3 Replies

10. UNIX for Dummies Questions & Answers

automate the input in a script

I have a program that i have to run by cron. The program needs user input. So i have to automate that in a littke script. start of script program.sh: result=program.log; export result echo Program starting : `date` >> $result /usr/local/program >> $result echo Program running : `date` >>... (11 Replies)
Discussion started by: erwinspeybroeck
11 Replies
Login or Register to Ask a Question