1752488 Members
5774 Online
108788 Solutions
New Discussion юеВ

Few issues.

 
SAMIR SHAH_1
Contributor

Few issues.

Hello everybody,

I have foll. queries for you friends...

1. In HP-UX, is there anyway to undelete file or Directory if removed with rm?
If no, why we can't do it?

2. I am attaching here two files.
1st: test which is there in /sbin/init.d and 2nd: profile which is the .profile file for user aplora.

I want to run test script at server startup for which I have created links successfully. In my .profile, I want that if it is run at server startup, it should not execute the dbmenu script which I have called in .profile. To do this, I am defining one global var. in test script called mname in which I store "root". In .profile file, I check that if mname <> 'root', then do some task.

However, in .profile, it does not behave the way I want it to.

3. suddenly, I am unable to go to my one directory named "Xerox" which is in my root dir. if I give cmd.

cd /Xerox
if gives foll. msg
sh: Xerox: not found

if I give ll Xer*, it shows foll.

drwxrwxrwx 3 root sys 96 Sep 25 1999 Xerox

I log in as root still it gives problem

if I give chmod 777 Xerox, it gives foll. msg.

chmod: can't access Xerox

What could be the problem?


Thanks in advance...

Samir.

7 REPLIES 7
Patrick Wallek
Honored Contributor

Re: Few issues.

To answer a couple of your questions:

#1) No you can't 'unrm' something that has been deleted with the rm command. That is why you should have backups. If something is accidentally removed then you restore it from backup. The main reason for not having an 'unrm' is probably that it would take to many system resources, especially disk space. Typically if I remove something I do so because 1) it isn't needed anymore, and 2) I want to free up disk space. If you had a 'Trash Can' feature, like Windows, then you would have to be sure and empty the 'Trash Can' periodically. How many people do you know that never empty the Windows trash can? I know several.....

#2) Not sure

#3) There is probably some extraneous character at the end of the Xerox name. Since you can do an ll on it, that does show that it exists. Try doing a 'cd Xerox*' and see if it lets you into the directory. If it does then there is a unprintable character at the end of the directory name. What you could do then is make a new directory called Xer and the copy everything from Xerox*/* into Xer. You could then remove the Xerox* directory and mv Xer to Xerox.
Serge Poitras
Frequent Advisor

Re: Few issues.

In Patrick'S reply to your #3 issue, he has a very good point in saying that there may be what is called a "non-printable" character in the Xerox string. In order to view (and possibly remove/mofify) this, simply run the following command one directory level above Xerox:

ll | cat -ev

..this should display any "non-printable" character embedded or following Xerox.

Best of luck,
Serge Poitras
Bill Hassell
Honored Contributor

Re: Few issues.

1. rm really means rm in Unix. Unlike DOS where a deleted file remains but a flag is put in the filename, or Windows where the default is to *NOT* remove the file but to move to a different location (the Trash Can), Unix marks the areas of the file as reusable. Within minutes or seconds, the area will probably be overwritten by a new file. rm in Unix means that you have regular backups.

2. The start/stop script looks fine. However, you do *NOT* want to run this script in .profile. The template is designed to run only at startup/shutdown and should be tested there. If the application fails to keep running, fix the application. If start/stop for the script fails to work, debug it with:

sh -x /sbin/init.d/your_script start

Most likel;y, the failure is related to environmental variables required by the /software1/app/oratst/startapltst.sh 'start' and su - aplora -c /software1/app/oratst/stopapltst.sh scripts. Use sh -x on those scripts too.

.profile - lots of notes:

>> TERM=vt100
>> export TERM

Never hardcode TERM=vt100. This guarentees problems when users run other types of terminal emulators. Always query the terminal and set TERM+LINES+COLUMNS:

eval $(ttytype -s)

>> name=`who am i|cut -c12-19`
>> add=`who -u|cut -c 52- | grep 192`

Never use cut -c to parse other commands. A small change made to the who output format will break all of your scripts. Use fields as in:

name=$(who -m | awk '{print $2}')
add=$(who -mu | awk '{print NR}')

who am i can be simplified to who -m. I believe that your who -u is incorrect, that you want the current IP address of the incoming user. who -mu will do that for you. awk's NR variable always finds the last field regardless of columns and total fields.

The date command has a ; at the end that doesn't look right. The rest of the .profile looks OK but you'll have to trace it to make sure (set -x in the .profile).

3. The ll/ls command has a very nice option: -b which will shows non-displayable special characters:

ls -b Xerox*


Bill Hassell, sysadmin
Bharat Katkar
Honored Contributor

Re: Few issues.

Samir,

If you want it to run during system startup then you have create link files in /sbin/rc2.d starting with "S" for startup and in /sbin/rc0.d starting with "K" for stopping that script.

Similarly if you want to manually start the script the you should say:
# /sbin/init.d/test start.

Need to structurised your files accordingly.
Hope that helps.
Regards,
You need to know a lot to actually know how little you know
Bharat Katkar
Honored Contributor

Re: Few issues.

Samir,
Also found one docs saying file recovery on UNIX systems but still i agree with the comments made above and don't trust this one.

As a last resort you can try it out (Fortunately i never had that time and also i never tried out that procedure)
see the attached doc.

All the best.

Regards,
You need to know a lot to actually know how little you know
Patrick Wallek
Honored Contributor

Re: Few issues.

FYI folks --- This question was posted more than 3.5 YEARS ago (Feb. 23, 2001)!!!!!!!
Bharat Katkar
Honored Contributor

Re: Few issues.

Don't know why SERGE pulled it out...
You need to know a lot to actually know how little you know