Re: Blacklisted Shell Script? --- not quite SOLVED ---

Dave <[email protected]>
Newsgroups gmane.user-groups.linux.ottawa.general
Message-ID <[email protected]>
Joe, it's been a long time! Good to hear from you. Notwithstanding my 
haphazard coding, I don't think that the if-fi count is the issue. 
However, it seems the system's sudden refusal to handle any "if" 
statements is the issue. (My if-fi count for the whole file I'm using is 
13-13.)

I misspoke when answering Brad's query whether there had been any system 
upgrades recently. It was his root-kit concern that reminded me that I'd 
applied a Grisoft upgrade from 7.5 to 8.5 and it was a real PITA. 
There's no GUI so I haven't a clue about configuration.

Brad also urged me to stick "echo" statements through the script "to see 
where it borked". The following summarizes today's efforts.

First there's the correlation between the installation date-time for 
AVG8.5, and when the script stopped working:

[whacker@fireball ~]$ ll /opt/avg/avg8
total 36
drwxr-xr-x 2 root bin 4096 2009-06-29 13:24 bin
drwxr-xr-x 2 root bin 4096 2009-06-29 19:37 cfg
drwxrwxr-x 2 root bin 4096 2009-06-29 13:24 doc
drwxr-xr-x 3 root bin 4096 2009-06-29 13:24 etc
drwxr-xr-x 2 root bin 4096 2009-06-29 13:24 lib
drwxrwxrwt 4 root bin 4096 2009-06-29 13:42 log
drwxr-xr-x 4 root bin 4096 2009-06-29 13:24 man
drwxr-xr-x 5 root bin 4096 2009-06-29 19:35 update
drwxr-xr-x 5 root bin 4096 2009-06-29 13:24 var

--- extract from script working directory ---
-rw-rw-r-- 1 whacker whacker      7 2009-06-29 13:25 running_flag
-rw-rw-r-- 1 whacker whacker     15 2009-06-29 13:24 last_ip
-rw-r--r-- 1 whacker whacker      7 2009-06-29 13:24 router_flag
-rw-r--r-- 1 whacker whacker      6 2009-06-29 10:43 ftp_flag
-rw-r--r-- 1 whacker whacker      2 2009-06-29 10:43 ftp_try
-rw-rw-r-- 1 whacker whacker 177658 2009-06-29 10:43 ipaddress.log
-rw-r--r-- 1 whacker whacker   1515 2009-06-29 10:43 message_content
-rw-r--r-- 1 whacker whacker      5 2009-06-29 10:43 NCF_flag
-rw-rw-r-- 1 whacker whacker     15 2009-06-29 10:43 NCF_ip
-rw-r--r-- 1 whacker whacker   1285 2009-06-29 10:43 tail_now
-rw-r--r-- 1 whacker whacker   1070 2009-06-29 10:43 NCF-status

A snippet of logging the "echo" statements output at one-minute intervals is ...
""
Another pass started
Line-2
1246740301
Line-before first IF statement
 
Another pass started
Line-2
1246740361
Line-before first IF statement
"".................

Output was "dead" for  ....

echo "Line-before second IF statement" >> ~barnett.log
echo "Line-before wget" >> ~barnett.log
echo "Line-after wget" >> ~barnett.log

So, things appear to hinge on "if".
I've considered uninstalling AVG8.5 for starters. 

BTW I needed to update my server domain address pointers ASAP, so I've 
kludged a script variant that includes everything but the conditionals, 
and revised my crontab invocation from "* * * * *" to "0 * * * *".

Email output is as follows (note - no today entries):
===================================

Recent connectivity activity. Recheck is due in 1200 minutes:
 
 On Wed Jun 24 14:37:07 EDT 2009 the router DSL connection was lost.
 On Thu Jun 25 11:54:04 EDT 2009 - Router IP Address is now 69.165.155.90
 On Thu Jun 25 19:53:03 EDT 2009 - Router IP Address is now 206.248.174.207
 On Thu Jun 25 19:53:41 EDT 2009 - NCF IP address update succeeded on try # 1. 
  
 On Fri Jun 26 01:55:01 EDT 2009 - Address confirmation was forced
 On Fri Jun 26 01:56:04 EDT 2009 - Router IP Address is now 206.248.174.207
 On Fri Jun 26 01:56:29 EDT 2009 - NCF IP address update succeeded on try # 1. 
  
 On Fri Jun 26 10:39:03 EDT 2009 the router DSL connection was lost.
 On Fri Jun 26 10:42:03 EDT 2009 - Router IP Address is now 206.248.177.184
 On Fri Jun 26 10:42:38 EDT 2009 - NCF IP address update succeeded on try # 1. 
  
 On Sat Jun 27 14:47:01 EDT 2009 - Address confirmation was forced
 On Sat Jun 27 14:48:03 EDT 2009 - Router IP Address is now 206.248.177.184
 On Sat Jun 27 14:48:29 EDT 2009 - NCF IP address update succeeded on try # 1. 
  
 On Sun Jun 28 13:34:04 EDT 2009 the router DSL connection was lost.
 On Sun Jun 28 13:35:03 EDT 2009 - Router IP Address is now 206.248.177.184
 On Mon Jun 29 10:43:04 EDT 2009 - Router IP Address is now 69.165.151.155
 On Mon Jun 29 10:43:31 EDT 2009 - NCF IP address update succeeded on try # 1. 
  
The links in the NCF referring pages have been updated.
 
Try http://206.248.177.43 in your browser to confirm that the web-site is at this address. 
 
David Robinson
===================================

Thanks for listening, now going horizontal;
Dave


Joe Burpee wrote:
> On Fri, Jul 03, 2009 at 15:18:06 -0400, Dave wrote:
>   
>> What am I up to? http://web.ncf.ca/carpe.machinam/NCF/Static.html  and  
>> http://web.ncf.ca/carpe.machinam/NCF/sanitized-ST-585-restore.sh tell  
>>     
>  
> FWIW Dave I think the line 131 comment "# -- up to this point, the if-fi
> count is equal" is incorrect.  Using grep I get 7 "if" and only 6 "fi".
> This might indicate a logic error.  Perhaps applying some consistent
> indentation rules to your if/else structures could help you see where
> the problem lies, or at least eliminate the need for comments like line
> 131.
>
> I notice that the first "if" (testing running_flag) is not closed by
> "fi" until the end of the script, and its "else" does nothing.  So if
> that first if-condition is false (meaning script-already-running)
> nothing much gets done in the whole script, which I assume is ok.  But
> if the script is ever interrupted prematurely, running_flag will not be
> reset to its not-running state.  If running_flag is not re-initialized
> externally, the script will never again do anything.
>
> Joe
>
>   
-- 
OCLUG general discussion list
[email protected]
http://oclug.on.ca/mailman/listinfo/oclug
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.