I'm trying to mount a volume as root.
I am using aws-efs-csi-driver v1.3.0 on Kubernetes 1.17 in EKS and trying to use Dynamic Provisioning.
My issue is that no matter how I try to specify the UID/GID, it still creates it with a dynamically allocated UID and GID.
Here are my resources:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: test-sc
provisioner: efs.csi.aws.com
parameters:
provisioningMode: efs-ap
fileSystemId: fs-ddd8b9e9
directoryPerms: "775"
uid: "0"
gid: "0"
reclaimPolicy: Retain
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: test-sc
resources:
requests:
storage: 50Gi
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: test
labels:
app: test
spec:
strategy:
type: Recreate
selector:
matchLabels:
app: test
replicas: 1
template:
metadata:
name: test
labels:
app: test
spec:
containers:
- name: test
image: ubuntu:latest
command: [ "/bin/sh" ]
args: [ "-c", "while true; do echo $(date -u) >> /example/out.txt; sleep 5; done" ]
imagePullPolicy: Always
volumeMounts:
- name: test-data
mountPath: /data
securityContext:
runAsUser: 0
runAsGroup: 0
fsGroup: 0
volumes:
- name: test-data
persistentVolumeClaim:
claimName: test-pvc
My issue is that I want the data directory to have the root:root permissions, and not the dynamically allocated permissions (50004:50004 in this case)
❯ kubectl exec -it test-9588c455c-qqdw6 -- bash
root#test-9588c455c-qqdw6:/# ls -las
total 4
0 drwxr-xr-x 1 root root 29 Oct 15 09:44 .
0 drwxr-xr-x 1 root root 29 Oct 15 09:44 ..
0 -rwxr-xr-x 1 root root 0 Oct 15 09:44 .dockerenv
0 lrwxrwxrwx 1 root root 7 Sep 21 16:48 bin -> usr/bin
0 drwxr-xr-x 2 root root 6 Apr 15 2020 boot
4 drwxrwxr-x 2 50004 50004 6144 Oct 15 09:44 data
0 drwxr-xr-x 5 root root 360 Oct 15 09:44 dev
0 drwxr-xr-x 1 root root 66 Oct 15 09:44 etc
0 drwxr-xr-x 2 root root 6 Apr 15 2020 home
0 lrwxrwxrwx 1 root root 7 Sep 21 16:48 lib -> usr/lib
0 lrwxrwxrwx 1 root root 9 Sep 21 16:48 lib32 -> usr/lib32
0 lrwxrwxrwx 1 root root 9 Sep 21 16:48 lib64 -> usr/lib64
0 lrwxrwxrwx 1 root root 10 Sep 21 16:48 libx32 -> usr/libx32
0 drwxr-xr-x 2 root root 6 Sep 21 16:48 media
0 drwxr-xr-x 2 root root 6 Sep 21 16:48 mnt
0 drwxr-xr-x 2 root root 6 Sep 21 16:48 opt
0 dr-xr-xr-x 415 root root 0 Oct 15 09:44 proc
0 drwx------ 2 root root 37 Sep 21 17:00 root
0 drwxr-xr-x 1 root root 21 Oct 15 09:44 run
0 lrwxrwxrwx 1 root root 8 Sep 21 16:48 sbin -> usr/sbin
0 drwxr-xr-x 2 root root 6 Sep 21 16:48 srv
0 dr-xr-xr-x 13 root root 0 Jun 11 09:16 sys
0 drwxrwxrwt 2 root root 6 Sep 21 17:00 tmp
0 drwxr-xr-x 13 root root 145 Sep 21 16:48 usr
0 drwxr-xr-x 11 root root 139 Sep 21 17:00 var
root#test-9588c455c-qqdw6:/# exit
Indeed annoying... in short, the UID/GID we specified will be ignored. Please take a look here. If your workload requires same UID/GID as the mounted volume, a workaround is add code to runas the same UID/GID as the mounted volume in entrypoint script.
Related
I am trying this
apiVersion: v1
kind: Secret
metadata:
name: stsadmin-keystores
labels:
tier: backend
app: stsadmin-keystores
namespace: {{ .Values.namespace }}
type: Opaque
data: {{ (.Files.Glob "secrets/*.jks").AsSecrets | indent 2 }}
and this works and I get the below on my pod
ls -lrt
--rw-r--r-- 1 root root 34822 Jul 11 05:49 truststore.jks
-rw-r--r-- 1 root root 5928 Jul 11 05:49 sts_client.jks
-rw-r--r-- 1 root root 5923 Jul 11 05:49 sp_client.jks
-rw-r--r-- 1 root root 5927 Jul 11 05:49 mb_client.jks
-rw-r--r-- 1 root root 5927 Jul 11 05:49 ch_client.jks
But when I am trying to get the secrets directory path from the values
apiVersion: v1
kind: Secret
metadata:
name: stsadmin-keystores
labels:
tier: backend
app: stsadmin-keystores
namespace: {{ .Values.namespace }}
type: Opaque
data:
{{- $path :=printf "%q/*.jks" .Values.secretSelector }}
{{ (.Files.Glob $path ).AsSecrets | indent 2 }}
the .jks files are copied as directories
ls -lrt
total 4
drwxrwxrwt 2 root root 40 Jul 11 04:38 mb_client.jks
drwxrwxrwt 2 root root 40 Jul 11 04:38 sp_client.jks
drwxrwxrwt 2 root root 40 Jul 11 04:38 sts_client.jks
drwxrwxrwt 2 root root 40 Jul 11 04:38 truststore.jks
drwxrwxrwt 7 root root 160 Jul 11 04:38 ch_client.jks
Can somebody help - where I am going wrong. I have spent days trying to fix this
I am running OS X 10.11.6 and MacMail 9.3 can not search my emails.
I 'rebuilt' my mailboxes and rebuilt my SpotLight indexes.
MacMail always reports 'Zero matches for search'.
Spotlight is saving in 'Store-V2', while the 'Envelope' indexes are in 'V3'.
What could be wrong?
$ pwd
/Users/davidlaxer/Library/Mail/V3/MailData
(base) MacBook-Pro:MailData davidlaxer$ ls -lrt Env*
-rwxr-xr-x# 1 davidlaxer staff 86241280 May 10 10:31 Envelope Index
-rwxr-xr-x# 1 davidlaxer staff 32768 May 10 11:20 Envelope Index-shm
-rwxr-xr-x# 1 davidlaxer staff 1512072 May 10 11:46 Envelope Index-wal
$ sudo du -g /.Spotlight-V100/
Password:
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.assisted_import_post
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.assisted_import_pre
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.corespotlight
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.health_check
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_priority
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_system
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_user
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.migration
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.migration_secondchance
0 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.scan
14 /.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039
14 /.Spotlight-V100//Store-V2
14 /.Spotlight-V100/
sudo ls -lRt /.Spotlight-V100/
total 8
drwx------ 3 root wheel 102 May 5 08:27 Store-V2
-rw------- 1 root wheel 4001 May 5 08:27 VolumeConfiguration.plist
/.Spotlight-V100//Store-V2:
total 0
drwx------ 119 root wheel 4046 May 10 11:50 CD1CE8CA-B264-41BC-909A-ACD3AE66F039
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039:
total 28512848
-rw------- 1 root wheel 261361664 May 10 11:51 .store.db
-rw------- 1 root wheel 6554 May 10 11:51 live.4.indexGroups
-rw------- 1 root wheel 65536 May 10 11:51 live.4.indexIds
-rw------- 1 root wheel 7452 May 10 11:51 journalAttr.153
-rw------- 1 root wheel 4614377 May 10 11:50 0.indexGroups
drwx------ 3 root wheel 102 May 10 11:50 journals.health_check
-rw------- 1 root wheel 4096 May 10 11:50 0.indexHead
-rw------- 1 root wheel 4096 May 10 11:50 tmp.spotlight.state
drwx------ 3 root wheel 102 May 10 11:46 journals.assisted_import_pre
-rw------- 1 root wheel 62 May 10 11:45 live.1.indexGroups
-rw------- 1 root wheel 616 May 10 11:45 live.1.indexIds
-rw------- 1 root wheel 4096 May 10 11:45 live.1.indexHead
-rw------- 1 root wheel 33554432 May 10 11:29 0.directoryStoreFile
-rw------- 1 root wheel 4194304 May 10 11:29 live.0.directoryStoreFile
-rw------- 1 root wheel 4096 May 10 11:29 live.0.indexHead
-rw------- 1 root wheel 65536 May 10 11:29 live.1.directoryStoreFile
-rw------- 1 root wheel 1048576 May 10 11:29 live.3.directoryStoreFile
-rw------- 1 root wheel 4096 May 10 11:29 live.3.indexHead
-rw------- 1 root wheel 65536 May 10 11:29 live.4.directoryStoreFile
-rw------- 1 root wheel 33554432 May 10 11:29 reverseDirectoryStore
-rw------- 1 root wheel 4096 May 10 11:29 live.4.indexHead
-rw------- 1 root wheel 25952256 May 10 11:29 0.directoryStoreFile.shadow
-rw------- 1 root wheel 4614377 May 10 11:29 0.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 11:29 0.shadowIndexHead
-rw------- 1 root wheel 28 May 10 11:29 indexState
drwx------ 3 root wheel 102 May 10 11:29 journals.assisted_import_post
drwx------ 3 root wheel 102 May 10 11:29 journals.live_system
drwx------ 3 root wheel 102 May 10 11:29 journals.live_user
-rw------- 1 root wheel 2752512 May 10 11:29 live.0.directoryStoreFile.shadow
-rw------- 1 root wheel 1144320 May 10 11:29 live.0.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 11:29 live.0.shadowIndexHead
-rw------- 1 root wheel 5952 May 10 11:29 live.1.directoryStoreFile.shadow
-rw------- 1 root wheel 62 May 10 11:29 live.1.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 11:29 live.1.shadowIndexHead
-rw------- 1 root wheel 786432 May 10 11:29 live.3.directoryStoreFile.shadow
-rw------- 1 root wheel 45288 May 10 11:29 live.3.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 11:29 live.3.shadowIndexHead
-rw------- 1 root wheel 17664 May 10 11:29 live.4.directoryStoreFile.shadow
-rw------- 1 root wheel 0 May 10 11:29 live.4.indexUpdates
-rw------- 1 root wheel 8388608 May 10 11:29 live.4.shadowIndexArrays
-rw------- 1 root wheel 1456 May 10 11:29 live.4.shadowIndexCompactDirectory
-rw------- 1 root wheel 19532 May 10 11:29 live.4.shadowIndexDirectory
-rw------- 1 root wheel 2932 May 10 11:29 live.4.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 11:29 live.4.shadowIndexHead
-rw------- 1 root wheel 2501400 May 10 11:29 live.4.shadowIndexPositionTable
-rw------- 1 root wheel 2501400 May 10 11:29 live.4.shadowIndexTermIds
-rw------- 1 root wheel 31719424 May 10 11:29 reverseDirectoryStore.shadow
-rw------- 1 root wheel 33 May 10 11:29 reverseStore.updates
-rw------- 1 root wheel 261361664 May 10 11:29 store.db
-rw------- 1 root wheel 3 May 10 11:29 store.updates
-rw------- 1 root wheel 8388608 May 10 11:29 live.4.indexArrays
-rw------- 1 root wheel 2048 May 10 11:29 live.4.indexCompactDirectory
-rw------- 1 root wheel 32896 May 10 11:29 live.4.indexDirectory
-rw------- 1 root wheel 4194304 May 10 11:29 live.4.indexPositionTable
-rw------- 1 root wheel 16777216 May 10 11:29 live.4.indexPositions
-rw------- 1 root wheel 8388608 May 10 11:29 live.4.indexPostings
-rw------- 1 root wheel 4194304 May 10 11:29 live.4.indexTermIds
-rw-r--r-- 1 root wheel 4 May 10 11:29 shutdown_time
-rw------- 1 root wheel 1144320 May 10 11:20 live.0.indexGroups
-rw------- 1 root wheel 11443200 May 10 11:20 live.0.indexIds
-rw------- 1 root wheel 45288 May 10 10:41 live.3.indexGroups
-rw------- 1 root wheel 452880 May 10 08:54 live.3.indexIds
-rw------- 1 root wheel 19262912 May 10 08:50 live.3.indexArrays
-rw------- 1 root wheel 4022314 May 10 08:50 live.3.indexCompactDirectory
-rw------- 1 root wheel 460544 May 10 08:50 live.3.indexDirectory
-rw------- 1 root wheel 31 May 10 08:50 live.3.indexUpdates
-rw------- 1 root wheel 35174385 May 10 08:50 live.3.indexPositions
-rw------- 1 root wheel 9377717 May 10 08:50 live.3.indexPostings
-rw------- 1 root wheel 65536 May 10 08:16 live.2.directoryStoreFile
-rw------- 1 root wheel 4096 May 10 08:16 live.2.indexHead
-rw------- 1 root wheel 1792 May 10 08:16 live.2.directoryStoreFile.shadow
-rw------- 1 root wheel 4 May 10 08:16 live.2.shadowIndexGroups
-rw------- 1 root wheel 4096 May 10 08:16 live.2.shadowIndexHead
-rw------- 1 root wheel 5937408 May 10 08:16 live.1.indexArrays
-rw------- 1 root wheel 732628 May 10 08:16 live.1.indexCompactDirectory
-rw------- 1 root wheel 722684 May 10 08:16 live.1.indexDirectory
-rw------- 1 root wheel 17 May 10 08:16 live.1.indexUpdates
-rw------- 1 root wheel 1332150 May 10 08:16 live.1.indexPositions
-rw------- 1 root wheel 381040 May 10 08:16 live.1.indexPostings
-rw------- 1 root wheel 3277 May 10 08:16 live.2.indexGroups
-rw------- 1 root wheel 2112 May 10 08:15 live.2.indexArrays
-rw------- 1 root wheel 8 May 10 08:15 live.2.indexCompactDirectory
-rw------- 1 root wheel 2056 May 10 08:15 live.2.indexDirectory
-rw------- 1 root wheel 32 May 10 08:15 live.2.indexIds
-rw------- 1 root wheel 704 May 10 08:15 live.2.indexPositionTable
-rw------- 1 root wheel 704 May 10 08:15 live.2.indexTermIds
-rw------- 1 root wheel 4096 May 10 08:15 live.2.indexPostings
-rw------- 1 root wheel 13 May 10 08:15 live.2.indexUpdates
-rw------- 1 root wheel 4096 May 10 08:15 live.2.indexPositions
-rw------- 1 root wheel 116111616 May 10 06:55 live.0.indexArrays
-rw------- 1 root wheel 16341676 May 10 06:55 live.0.indexCompactDirectory
-rw------- 1 root wheel 7297772 May 10 06:55 live.0.indexDirectory
-rw------- 1 root wheel 125 May 10 06:55 live.0.indexUpdates
-rw------- 1 root wheel 233745118 May 10 06:55 live.0.indexPositions
-rw------- 1 root wheel 92373248 May 10 06:55 live.0.indexPostings
-rw------- 1 root wheel 46143768 May 9 17:44 0.indexIds
drwx------ 3 root wheel 102 May 8 15:29 journals.live_priority
-rw------- 1 root wheel 814959 May 8 15:29 tmp.spotlight.loc
-rw------- 1 root wheel 1863674176 May 7 15:28 0.indexArrays
-rw------- 1 root wheel 421591410 May 7 15:28 0.indexCompactDirectory
-rw------- 1 root wheel 32731520 May 7 15:28 0.indexDirectory
-rw------- 1 root wheel 1815 May 7 15:28 0.indexUpdates
-rw------- 1 root wheel 9492016397 May 7 15:21 0.indexPositions
-rw------- 1 root wheel 1462613059 May 7 15:21 0.indexPostings
drwx------ 3 root wheel 102 May 7 14:10 journals.scan
-rw------- 1 root wheel 0 May 5 08:27 Cab.created
-rw------- 1 root wheel 0 May 5 08:27 Lion.created
-rw------- 1 root wheel 0 May 5 08:27 journalAttr.1
-rw------- 1 root wheel 0 May 5 08:27 journalExclusion
drwx------ 2 root wheel 68 May 5 08:27 journals.corespotlight
drwx------ 2 root wheel 68 May 5 08:27 journals.live
drwx------ 2 root wheel 68 May 5 08:27 journals.migration
drwx------ 2 root wheel 68 May 5 08:27 journals.migration_secondchance
-rw-r--r-- 1 root wheel 4 May 5 08:27 store_generation
-rw------- 1 root wheel 0 May 5 08:27 tmp.Cab
-rw------- 1 root wheel 0 May 5 08:27 tmp.Lion
-rw------- 1 root wheel 0 May 5 08:27 tmp.SnowLeopard
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.health_check:
total 0
-rw------- 1 root wheel 0 May 10 11:50 retire.10586
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.assisted_import_pre:
total 0
-rw------- 1 root wheel 0 May 10 11:46 retire.155623
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.assisted_import_post:
total 0
-rw------- 1 root wheel 0 May 10 11:29 retire.372
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_system:
total 0
-rw------- 1 root wheel 0 May 10 11:29 retire.359623
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_user:
total 0
-rw------- 1 root wheel 0 May 10 11:29 retire.970891
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live_priority:
total 0
-rw------- 1 root wheel 0 May 8 15:29 retire.272870
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.scan:
total 0
-rw------- 1 root wheel 0 May 7 14:10 retire.5816751
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.corespotlight:
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.live:
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.migration:
/.Spotlight-V100//Store-V2/CD1CE8CA-B264-41BC-909A-ACD3AE66F039/journals.migration_secondchance:
The directory ~/Library/Metadata/CoreSpotlight/ was missing.
/private/var/folders had directories owned by a non-existent user.
Clearly, the disk cloning had issues.
The solution was to do a clean reinstall the OS and use the migration assistant.
I am using configmaps to populate configuration of few services. One container though is having a weird behavior. Several directories are created upon instanciation and then new ones every 2 minutes:
0 drwxr-xr-x 4 root root 90 Feb 15 14:45 ..2982_15_02_14_45_49.335148891
0 drwxr-xr-x 4 root root 90 Feb 15 14:45 ..2982_15_02_14_45_52.091968736
0 drwxr-xr-x 4 root root 90 Feb 15 14:45 ..2982_15_02_14_45_53.797898431
0 drwxr-xr-x 4 root root 90 Feb 15 14:45 ..2982_15_02_14_45_54.421758226
0 drwxr-xr-x 4 root root 90 Feb 15 14:45 ..2982_15_02_14_45_56.209637705
0 drwxr-xr-x 4 root root 90 Feb 15 14:46 ..2982_15_02_14_46_00.970889748
0 drwxr-xr-x 4 root root 90 Feb 15 14:46 ..2982_15_02_14_46_08.301261923
[..]
0 drwxr-xr-x 4 root root 90 Feb 15 15:22 ..2982_15_02_15_22_01.877596759
0 drwxr-xr-x 4 root root 90 Feb 15 15:24 ..2982_15_02_15_24_01.626300874
0 drwxr-xr-x 4 root root 90 Feb 15 15:26 ..2982_15_02_15_26_01.042779297
0 drwxr-xr-x 4 root root 90 Feb 15 15:28 ..2982_15_02_15_28_01.708510604
0 drwxr-xr-x 4 root root 90 Feb 15 15:30 ..2982_15_02_15_30_01.032055163
0 drwxr-xr-x 4 root root 90 Feb 15 15:32 ..2982_15_02_15_32_01.089879198
0 drwxr-xr-x 4 root root 90 Feb 15 15:34 ..2982_15_02_15_34_02.798668133
0 lrwxrwxrwx 1 root root 31 Feb 15 15:34 ..data -> ..2982_15_02_15_34_02.798668133
4 drwxr-xr-x 2 root root 4096 Feb 15 14:45 apps.d
4 drwxr-xr-x 2 root root 4096 Feb 15 14:45 conf.d
0 lrwxrwxrwx 1 root root 21 Feb 15 14:45 fastcgi-params -> ..data/fastcgi-params
0 lrwxrwxrwx 1 root root 20 Feb 15 14:45 frontend.conf -> ..data/frontend.conf
0 lrwxrwxrwx 1 root root 17 Feb 15 14:45 nginx.conf -> ..data/nginx.conf
0 drwxrwxrwt 3 root root 120 Feb 15 14:45 ssl
YAML looks like this:
volumeMounts:
[..]
- name: default-nginx-config
mountPath: /etc/nginx
- name: default-nginx-slash-srv
mountPath: /srv
volumes:
[..]
- name: default-nginx-config
configMap:
name: web-frontend-default
items:
- key: fastcgi-params
path: fastcgi-params
- key: frontend.conf
path: frontend.conf
- key: nginx.conf
path: nginx.conf
- key: internal.conf
path: conf.d/internal.conf
- key: common-static-app.conf
path: conf.d/common-static-app.conf
- key: common-backends.conf
path: conf.d/common-backends.conf
- key: common-dynamic-app.conf
path: conf.d/common-dynamic-app.conf
- key: 00-generic.conf
path: apps.d/00-generic.conf
- key: default.conf
path: apps.d/default.conf
- name: default-nginx-slash-srv
configMap:
name: web-frontend-default
items:
- key: probe.html
path: probe.html
Any hint will be, of course, much appreciated :-)
Thank you
Well fixed :-)
Problem was two volumes mounted in the same target directory. k8s doesn't seem to like it.
Thank you Eric!
I was also having issues with two files being accessed before they were fully mounted. The workaround was making my ENTRYPOINT a bash script that simply moved them from the mount directory in the root level, to the actual file location they were being used, then calling the program binary.
How do I read from these sensors? I just found their location, but the folder appears to contain softlinks to another location. My goal is to monitor the gyroscope.
$ ls /sys/bus/iio/devices/iio:device*
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200073.1.auto/iio:device0
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200076.2.auto/iio:device1
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device2 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200083.3.auto/iio:device2
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device3 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200086.4.auto/iio:device3
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device4 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-20008a.5.auto/iio:device4
lrwxrwxrwx 1 root root 0 Jan 31 23:18 /sys/bus/iio/devices/iio:device5 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200041.6.auto/iio:device5
Using cat:
$ cat /sys/bus/iio/devices/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:0483:91D1.0018/HID-SENSOR-200073.1.auto/iio:device0
Here is a nice presentation on IIO subsystem.
I want to copy specific file done last changes in Oct 16-17,file type is java.
shia#ubuntu:~/code$ ls -alxo
total 96
drwx------ 2 shia 4096 Oct 20 18:54 .
drwxr-xr-x 61 shia 12288 Oct 20 19:24 ..
-rw------- 1 shia 12288 Oct 16 21:52 .Reuse.java.swp
-rw-rw-r-- 1 shia 746 Oct 20 11:16 Argus.class
-rw-rw-r-- 1 shia 302 Oct 20 11:16 Argus.java
-rw------- 1 shia 310 Oct 16 21:30 Call.java
-rw-rw-r-- 1 shia 417 Oct 17 15:20 Ordinary.class
-rw-rw-r-- 1 shia 298 Oct 17 14:57 Overriding.java
-rw-rw-r-- 1 shia 562 Oct 19 21:27 Package.class
-rw-rw-r-- 1 shia 430 Oct 19 21:27 Package.java
-rw------- 1 shia 729 Oct 17 13:50 Reuse.java
-rw------- 1 shia 424 Oct 17 13:47 Room.java
-rw------- 1 shia 321 Oct 16 21:22 Simpleobject.java
-rw-rw-r-- 1 shia 1187 Oct 17 00:04 Static.java
-rw-rw-r-- 1 shia 686 Oct 17 15:20 Super.class
-rw-rw-r-- 1 shia 1010 Oct 17 15:20 Super.java
-rw------- 1 shia 843 Oct 17 14:20 This.java
-rw-rw-r-- 1 shia 521 Oct 17 14:51 b.java
-rw-rw-r-- 1 shia 90 Oct 20 18:54 cp.awk
-rw-rw-r-- 1 shia 105 Oct 20 17:19 file.txt
I try to specific them but i don't know how to copy them.
shia#ubuntu:~/code$ ls -alxo|grep 'Oct 1[67].*java$'|awk '{print $8}'
Call.java
Overriding.java
Reuse.java
Room.java
Simpleobject.java
Static.java
Super.java
This.java
b.java
Any help,thanks a lot!
One way using find:
find . -maxdepth 1 -type f -name "*.java" -newermt 2012-10-16 ! -newermt 2012-10-18 -exec cp '{}' /home/user/dstFolder/ \;
You can use xargs to copy the files found:
...| xargs -i cp '{}' /home/user/dstFolder/
This will copy all the files found to the folder /home/user/dstFolder/.