SunOS (Solaris) is not Linux. Don't expect Linux utilities to have the same behaviour as Solaris utilities of the same name. Have you checked the man page for fuser on Solaris?
Solaris:
Linux:
You will have to change the way fuser is called in the Solaris version.
Personally I would be inclined to write a script; something like:
and call it, say, checklog, and then modify the find thus:
Andrew
You were right. The interesting part is, that the same command works on Solaris also, but the fuser flags must be changed to
I am facing some strange problem.
I know, there is only one record in a file 'test.txt' which starts with 'X'
I ensure that with following command,
awk /^X/ test.txt | wc -l
This gives me output = '1'.
Now I take out this record out of the file, as follows :
awk /^X/ test.txt >... (1 Reply)
I have a script with a find command using xargs to copy the files found to another directory. The find command is finding the appropriate file, but it's not copying. I've checked permissions, and those are all O.K., so I'm not sure what I'm missing. Any help is greatly appreciated.
This is... (2 Replies)
Hi,
i wan to search the file starting with Admin into the directory Output. I am running below command:
find /appl/Output -name "Admin*" -prune
but this command is going into the sub directories present under output. I do not want to search under sub directories. Any help will be highly... (6 Replies)
i am using sunos 5.9.
entityname="india\/delhi"
correctpattern="<branch value=\"/`echo $entityname | tr -d '\'`/WORKAREA/\">
echo $correctpattern
the output should be
<branch value="/india/delhi/WORKAREA/">
This is working fine in command line but not working when i placed these... (1 Reply)
trying to find a way to locate files modified in the last hour in a shell script, unfortunately the command 'find . -mmin -60' is not supported on SunOS 5.10 (works on OpenSolaris 5.11 :mad:)
Does anyone know a method of doing this in shell script on 5.10?
cheers (19 Replies)
I have a situation where the system is dumping a 2g causing filesystem to fill up. We identified the source and working on a solution. However, I wanted to limit the size of the 'core' file.
Please examine the test scenario ...
cnewtonne@mars> ulimit -f 0
cnewtonne@mars> ls -ltr core*... (2 Replies)
I have the following files in a directory
> ls -1 /tmp/test/dir/
file with spaces 1.ogg
file with spaces 2.oggI am running the following to echo the filenames but alter the file extension on the files to .mp3 instead of .ogg ( I am going to run ffmpeg against the files ultimately, but keeping... (2 Replies)
I m trying to send o/p of one file using mailx command but is not working
PFB command :
cat healthchecklog | mailx -s "HEALTH CHECKS" abc@jkl.com
also I have checked the ps -ef for mailx which is giveing below o/p
ps -ef | grep mail
root 364 1 0 Jun 08 ? ... (11 Replies)
Hello,
I am trying to write a housekeeping that finds all .trc files older than x days in a given FS, checks if they are used and gzips them if they are not used by any process. I need to do it without calling any additional .sh script.
I managed to make it work for Linux only:
find .... (4 Replies)
Hi,
Not sure whether there is a fuser alternative or any better way to check for file in use or not.
I am wanting to check whether files are in use or not before removing them. Using fuser, the awk seems to be giving me 'weird' output not to mention that it is giving me 2 lines instead of... (0 Replies)
Discussion started by: newbie_01
0 Replies
LEARN ABOUT SUNOS
fuser
fuser(1M) System Administration Commands fuser(1M)NAME
fuser - identify users of files and devices
SYNOPSIS
/usr/sbin/fuser [-c | -d | -f] [-nu] [-k | -s sig] files [ [- ] [-c | -d | -f] [-nu] [-k | -s sig] files] ...
DESCRIPTION
The fuser utility displays the process IDs of the processes that are using the files specified as arguments.
Each process ID is followed by a letter code. These letter codes are interpreted as follows. If the process is using the file as
c Indicates that the process is using the file as its current directory.
m Indicates that the process is using a file mapped with mmap(2). See mmap(2) for details.
n Indicates that the process is holding a non-blocking mandatory lock on the file.
o Indicates that the process is using the file as an open file.
r Indicates that the process is using the file as its root directory.
t Indicates that the process is using the file as its text file.
y Indicates that the process is using the file as its controlling terminal.
For block special devices with mounted file systems, all processes using any file on that device are listed. For all types of files (text
files, executables, directories, devices, and so forth), only the processes using that file are reported.
For all types of devices, fuser also displays any known kernel consumers that have the device open. Kernel consumers are displayed in one
of the following formats:
[module_name]
[module_name,dev_path=path]
[module_name,dev=(major,minor)]
[module_name,dev=(major,minor),dev_path=path]
If more than one group of files are specified, the options may be respecified for each additional group of files. A lone dash cancels the
options currently in force.
The process IDs are printed as a single line on the standard output, separated by spaces and terminated with a single new line. All other
output is written on standard error.
Any user can run fuser, but only the superuser can terminate another user's process.
OPTIONS
The following options are supported:
-c Reports on files that are mount points for file systems, and any files within that mounted file system.
-d Report device usage information for all minor nodes bound to the same device node as the specified minor node. This option does
not report file usage for files within a mounted file system.
-f Prints a report for the named file, not for files within a mounted file system.
-k Sends the SIGKILL signal to each process. Since this option spawns kills for each process, the kill messages may not show up imme-
diately (see kill(2)). No signals will be sent to kernel file consumers.
-n Lists only processes with non-blocking mandatory locks on a file.
-s sig Sends a signal to each process. The sig option argument specifies one of the symbolic names defined in the <signal.h> header, or a
decimal integer signal number. If sig is a symbolic name, it is recognized in a case-independent fashion, without the SIG prefix.
The -k option is equivalent to -s KILL or -s 9. No signals will be sent to kernel file consumers.
-u Displays the user login name in parentheses following the process ID.
EXAMPLES
Example 1: Reporting on the Mount Point and Files
The following example reports on the mount point and files within the mounted file system.
example% fuser -c /export/foo
Example 2: Restricting Output when Reporting on the Mount Point and Files
The following example reports on the mount point and files within the mounted file system, but the output is restricted to processes that
hold non-blocking mandatory locks.
example% fuser -cn /export/foo
Example 3: Sending SIGTERM to Processes Holding a Non-blocking Mandatory Lock
The following command sends SIGTERM to any processes that hold a non-blocking mandatory lock on file /export/foo/my_file.
example% fuser -fn -s term /export/foo/my_file
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of fuser: LANG, LC_ALL LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO ps(1), mount(1M), kill(2), mmap(2), signal(3C), attributes(5), environ(5), standards(5)NOTES
Because fuser works with a snapshot of the system image, it may miss processes that begin using a file while fuser is running. Also, pro-
cesses reported as using a file may have stopped using it while fuser was running. These factors should discourage the use of the -k
option.
SunOS 5.10 21 Oct 2003 fuser(1M)