File: smartctl_subst.sh

package info (click to toggle)
gsmartcontrol 2.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,904 kB
  • sloc: cpp: 66,205; sh: 240; ansic: 125; xml: 33; makefile: 13
file content (27 lines) | stat: -rwxr-xr-x 611 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
###############################################################################
# License: BSD Zero Clause License file
# Copyright:
#   (C) 2008 - 2022 Alex Butcher <alex dot butcher 'at' assursys.co.uk>
#   (C) 2008 - 2022 Alexander Shaduri <ashaduri@gmail.com>
###############################################################################

if [ "$1" = "-V" ]; then
	smartctl -V 2>&1
	exit
fi

while [ $# -ge 1 ]; do
	device="$1"
	shift
done

if [ "$device" = "" ]; then
	echo "Usage: $0 <device>"
	exit 1;
fi

dev_base=$(basename "$device")
out_file=/var/run/smart-"$dev_base"

cat "$out_file"