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 users log into the application front end they will see this message and phone number/email etc and they click on dismiss or continue to progress. Image attached.
I am only interested in the service message portion, to include few lines, nothing else...How can this be achieved using any regular expression commands or simple script?
I am using Linux version 7.2 and I want users to see the message when they log into the application via front end i.e. url. And here they will see the message and click on dismiss continue etc... This could be when we are delivering a new release, every quarter and so on.
At the moment it is just manual process, and just needs the message portion, few lines automating, within a .sh script probably will do the trick.
Hope this helps. Please Advise.
Gaz
---------- Post updated at 12:42 PM ---------- Previous update was at 09:46 AM ----------
The other thing is /etc/motd probably works as if you are logging into a shell rather than displaying this message on front end application, so been searching around, don't think that will be helpful?
I don't know if there is something sed command or simpler which can replace or setup custom tags between the service message?
Yes, it could be in html as currently the file which has that service message line "xxxxx" is in html. Therefore, I thought there could be something using some file manipulation commands to read from another file to achieve this though...maybe not....
Its an application used for criminal justice system running on backend WebSphere/Linux and DB2.
You cant do it from the app, otherwise it would have been done but its been done manually by editing the service.message file but we just want this portion updated...whether its a one liner, realistically speaking not really required to invest time and effort but business want this automated so the transition team then can support the app and run the automation in future.
I was looking at SED, today, maybe there is some way to set this up...
Hope this Helps.
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.
( 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.
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.
<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>
#!/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.
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?