Create day-07-linux-fs-and-scenarios.md #557
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi
#####################################################################
Scenario 1: Service Not Starting
Que:- A web application service called 'myapp' failed to start after a server reboot.
What commands would you run to diagnose the issue?
Write at least 4 commands in order.
Ans:-
1:- # systemctl status myapp # (shows myapp service running/stop/failed)
2:- Check recent logs.
journalctl -u myapp -n 50 # (shows error what the issue is, like config issue, port issue, permission issue)
3:-
systemctl is-enabled myapp # (this CMD enables server permanently; when the server is restart or boot the server server is running.)
4:-
systemctl daemon-reload
systemctl restart myapp # when apply any change, you need to restart service to apply changes
Scenario 2: High CPU Usage
Que:- Your manager reports that the application server is slow.
You SSH into the server. What commands would you run to identify
which process is using high CPU?
ans:-
1:-
run the # top (showing CPU/ram usage)
2:-
ps aux --sort=-%cpu | head -10 (show which process use heavy CPU)
Scenario 3: Finding Service Logs
Que:-A developer asks: "Where are the logs for the 'docker' service?"
The service is managed by systemd.
What commands would you use?
ans:-
systemctl status docker (frist check docker running or stop)
journalctl -u docker -n 50 (show last 50 error/issue log)
journalctl -u docker -f
Scenario 4: File Permissions Issue
Que:- A script at /home/user/backup.sh is not executing.
When you run it: ./backup.sh
You get: "Permission denied"
What commands would you use to fix this?
Ans:-
ls -l /home/user/backup.sh (show current permission if executable permission )
chmod +x /home/user/backup.sh (given executable permission)
./backuo.sh (run & check it)