forked from galacticcouncil/hydration-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean.sh
27 lines (21 loc) · 859 Bytes
/
clean.sh
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
#!/bin/bash
echo "Searching for running cargo processes..."
# Find all cargo processes
CARGO_PROCESSES=$(ps aux | grep "[c]argo" | awk '{print $2}')
if [ -z "$CARGO_PROCESSES" ]; then
echo "No running cargo processes found."
else
echo "Killing the following cargo processes:"
echo "$CARGO_PROCESSES"
# Kill all cargo processes
echo "$CARGO_PROCESSES" | xargs kill -9
echo "All cargo processes terminated."
fi
echo "Removing cargo lock files..."
# Find and remove any lock files in the target directories
find . -type f -name ".cargo-lock" -exec rm -f {} \;
find . -type f -name ".crates.lock" -exec rm -f {} \;
echo "Clearing cargo target directory locks..."
# Check and remove lingering locks in target directories
find . -type f -name ".lock" -exec rm -f {} \;
echo "Done. You can now run cargo commands without interference."