01-30-2009
Ignore "a line" within /etc/profile only when su'ing
Is there a way to ignore a command within /etc/profile only when su'ing as any particular user.
For instance....
As root, if I run "su - oracle -c program" it is running a string in my profile called "echo "^[]2;$(hostname)-(ABC) @ $(who am i)^G".
I don't want the above string to run if I am su'ing, because it is causing a title to be placed in an email notification which is something I'd like to eliminate if I can.
Simply running su - oracle -c "program" from command line doesn't show the title page in the output. The title page is only seen when "su - oracle -c" is run within a script.
I am running a generic script to test and try to eliminate the title from showing up in email notifications. Below is the test script....
#!/bin/ksh
su - oracle -c "ifconfig -a" >> /var/adm/log/temp.log
cat /var/adm/log/temp.log | mailx -s "processes" lwif_mail
rm /var/adm/log/temp.log
If the above commands are run within a script it generates the "title" within the notification since /etc/profile is called when su - is used. Below is an example of this output. The first line is not desired, (I marked it with an underline).
]2;hostname-(PAN) @ lwif pts/1 Jan 29 16:47 (lwif.us.com)
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
zone lwif1
inet 127.0.0.1 netmask ff000000
ce0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
If each line is run individually from command line it "does not" produce the "title" page with the email notification and if just running "su oracle" the title is not displayed, but this is not an option.
Please let me know if there is a workaround for this.
Thanks,
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
A bit of a dumb question here. Sorry folks.
Suppose I have this file which is being updated at irregular intervals (a few seconds, a few minutes, who knows) by a background process.
I 'vi' this file with the intention of editing it, so it opens up a temp copy as the usual... (8 Replies)
Discussion started by: Percy
8 Replies
2. UNIX for Dummies Questions & Answers
Hi
I know from reading O Riley's Classic Shell Scripting' that the .profile file is " the shells configuration file" but I am unable to find a reference to what "..profile" means. I have searched on the net, Sams Teach Yourself Unix, Unix Visual Quickstart Guide and Linux in a Nutshell. I have... (2 Replies)
Discussion started by: zorrokan
2 Replies
3. UNIX for Dummies Questions & Answers
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
4. Shell Programming and Scripting
Dear friends, following is the output of a script from which I want to remove spaces and new-line characters.
Example:-
Line1 abcdefghijklmnopqrstuvwxyz
Line2 mnopqrstuvwxyzabcdefghijkl
Line3 opqrstuvwxyzabcdefdefg
Here in above example, at every starting line there is a “tab” &... (4 Replies)
Discussion started by: anushree.a
4 Replies
5. Shell Programming and Scripting
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Discussion started by: shis100
7 Replies
6. Shell Programming and Scripting
I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies
7. Shell Programming and Scripting
Okay, so I have a rather large text file and will have to process many more and this will save me hours of work.
I'm not very good at scripting, so bear with me please.
Working on Linux RHEL
I've been able to filter and edit and clean up using sed, but I have a problem with moving lines.
... (9 Replies)
Discussion started by: rex007can
9 Replies
8. Shell Programming and Scripting
Dear Ladies & Gents,
I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out:
for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies
9. Shell Programming and Scripting
Hi everybody,
I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o
My code:
#!/bin/sh
set -e
set -u
export IFS=
optl="Optl"
LOCSTORCLI="/opt/lsi/storcli/storcli"
($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
Discussion started by: Subsonic66
5 Replies
10. Shell Programming and Scripting
Hi,
There are 2 users (T886072 & T864764) that need to be provided full (rwx) access to a directory. I made the changes to the directory permissions using chmod and setfacl :
root@digidb2:# chmod 700 /u02/ftpfiles/MFRS16/discount_rates/
root@digidb2:# setfacl -s... (3 Replies)
Discussion started by: anaigini45
3 Replies
PON(1) Debian PPPD PON(1)
NAME
pon, poff, plog - starts up, shuts down or lists the log of PPP connections
SYNOPSIS
pon [ isp-name [ options ] ]
poff [ -r ] [ -d ] [ -c ] [ -a ] [ -h ] [ isp-name ]
plog [ arguments ]
DESCRIPTION
This manual page describes the pon, plog and poff scripts, which allow users to control PPP connections.
pon
pon, invoked without arguments, runs the /etc/ppp/ppp_on_boot file, if it exists and is executable. Otherwise, a PPP connection will be
started using configuration from /etc/ppp/peers/provider. This is the default behaviour unless an isp-name argument is given.
For instance, to use ISP configuration "myisp" run:
pon myisp
pon will then use the options file /etc/ppp/peers/myisp. You can pass additional pppd options after the ISP name, too. pon can be used to
run multiple, simultaneous PPP connections.
pon takes the following command line options:
-q --quick
disconnect when ip-up finishes running. This function is only available to the root user.
poff
poff closes a PPP connection. If more than one PPP connection exists, the one named in the argument to poff will be killed, e.g.
poff myprovider2
will terminate the connection to myprovider2, and leave the PPP connections to e.g. "myprovider1" or "myprovider3" up and running.
poff takes the following command line options:
-r causes the connection to be redialed after it is dropped.
-d toggles the state of pppd's debug option.
-c causes pppd(8) to renegotiate compression.
-a stops all running ppp connections. If the argument isp-name is given it will be ignored.
-h displays help information.
-v prints the version and exits.
If no argument is given, poff will stop or signal pppd if and only if there is exactly one running. If more than one connection is
active, it will exit with an error code of 1.
plog
plog shows you the last few lines of /var/log/ppp.log. If that file doesn't exist, it shows you the last few lines of your /var/log/syslog
file, but excluding the lines not generated by pppd. This script makes use of the tail(1) command, so arguments that can be passed to
tail(1) can also be passed to plog.
Note: the plog script can only be used by root or another system administrator in group "adm", due to security reasons. Also, to have all
pppd-generated information in one logfile, that plog can show, you need the following line in your /etc/syslog.conf file:
local2.* -/var/log/ppp.log
FILES
/etc/ppp/options
PPPd system options file.
/etc/ppp/pap-secrets
System PAP passwords file.
/etc/ppp/chap-secrets
System CHAP passwords file.
/etc/ppp/peers/
Directory holding the peer options files. The default file is called provider.
/etc/chatscripts/provider
The chat script invoked from the default /etc/ppp/peers/provider.
/var/log/ppp.log
The default PPP log file.
AUTHORS
The p-commands were written by Christoph Lameter <clameter@debian.org>. Updated and revised by Philip Hands <phil@hands.com>.
This manual was written by Othmar Pasteka <othmar@tron.at>. Modified by Rob Levin <lilo@openprojects.net>, with some extensions taken from
the old p-commands manual written by John Hasler <jhasler@debian.org>.
SEE ALSO
pppd(8), chat(8), tail(1).
Debian Project July 2000 PON(1)